diff --git a/source/glest_game/ai/ai.cpp b/source/glest_game/ai/ai.cpp index d51f5b56..81060790 100644 --- a/source/glest_game/ai/ai.cpp +++ b/source/glest_game/ai/ai.cpp @@ -663,7 +663,7 @@ bool Ai::findPosForBuilding(const UnitType* building, const Vec2i &searchPos, Ve for(int i=searchPos.x - currRadius; i < searchPos.x + currRadius; ++i) { for(int j=searchPos.y - currRadius; j < searchPos.y + currRadius; ++j) { outPos= Vec2i(i, j); - if(aiInterface->isFreeCells(outPos - Vec2i(minBuildSpacing), building->getSize() + minBuildSpacing * 2, fLand)) { + if(aiInterface->isFreeCells(outPos - Vec2i(minBuildSpacing), building->getAiBuildSize() + minBuildSpacing * 2, fLand)) { return true; } } diff --git a/source/glest_game/types/unit_type.cpp b/source/glest_game/types/unit_type.cpp index cde886bb..be0deae6 100644 --- a/source/glest_game/types/unit_type.cpp +++ b/source/glest_game/types/unit_type.cpp @@ -141,6 +141,7 @@ UnitType::UnitType() : ProducibleType() { armor=0; sight=0; size=0; + aiBuildSize=-1; renderSize=0; height=0; burnHeight=0; @@ -233,6 +234,10 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, if(parametersNode->hasChild("render-size")){ renderSize=parametersNode->getChild("render-size")->getAttribute("value")->getIntValue(); } + aiBuildSize=size; + if(parametersNode->hasChild("ai-build-size")){ + aiBuildSize= parametersNode->getChild("ai-build-size")->getAttribute("value")->getIntValue(); + } //height //checkItemInVault(&(this->height),this->height); diff --git a/source/glest_game/types/unit_type.h b/source/glest_game/types/unit_type.h index 27604710..fced61b1 100644 --- a/source/glest_game/types/unit_type.h +++ b/source/glest_game/types/unit_type.h @@ -196,6 +196,7 @@ private: bool commandable; int sight; int size; //size in cells + int aiBuildSize; int renderSize; //size to render in cells int height; int burnHeight; @@ -288,6 +289,7 @@ public: inline bool isCommandable() const {return commandable;} inline int getSight() const {return sight;} inline int getSize() const {return size;} + inline int getAiBuildSize() const {return aiBuildSize;} inline int getRenderSize() const {return renderSize;} int getHeight() const {return height;} int getBurnHeight() const {return burnHeight;}