new tag <ai-build-size>

This commit is contained in:
titiger 2016-12-10 16:01:26 +01:00
parent 7f55d9fc1d
commit cd8530f69e
3 changed files with 8 additions and 1 deletions

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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;}