1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

CastleInterface: Exclude previous building upgrade in reqs

Hide CityHall from Capitol prerequisites in Capitol build window
This commit is contained in:
Sandy Carter 2015-08-19 12:05:43 -04:00
parent 237d3f2624
commit bdee647525
3 changed files with 5 additions and 4 deletions

View File

@ -1364,7 +1364,7 @@ std::string CBuildWindow::getTextForState(int state)
};
ret = CGI->generaltexth->allTexts[52];
ret += "\n" + town->genBuildingRequirements(building->bid).toString(toStr);
ret += "\n" + town->genBuildingRequirements(building->bid, false).toString(toStr);
break;
}
case EBuildingState::MISSING_BASE:

View File

@ -1046,7 +1046,7 @@ bool CGTownInstance::hasBuilt(BuildingID buildingID) const
return vstd::contains(builtBuildings, buildingID);
}
CBuilding::TRequired CGTownInstance::genBuildingRequirements(BuildingID buildID) const
CBuilding::TRequired CGTownInstance::genBuildingRequirements(BuildingID buildID, bool includeUpgrade) const
{
const CBuilding * building = town->buildings.at(buildID);
@ -1069,7 +1069,8 @@ CBuilding::TRequired CGTownInstance::genBuildingRequirements(BuildingID buildID)
{
const CBuilding * upgr = town->buildings.at(building->upgrade);
requirements.expressions.push_back(upgr->bid);
if (includeUpgrade)
requirements.expressions.push_back(upgr->bid);
requirements.expressions.push_back(upgr->requirements.morph(dependTest));
}
requirements.expressions.push_back(building->requirements.morph(dependTest));

View File

@ -233,7 +233,7 @@ public:
bool armedGarrison() const; //true if town has creatures in garrison or garrisoned hero
int getTownLevel() const;
CBuilding::TRequired genBuildingRequirements(BuildingID build) const;
CBuilding::TRequired genBuildingRequirements(BuildingID build, bool includeUpgrade=true) const;
void removeCapitols (PlayerColor owner) const;
void addHeroToStructureVisitors(const CGHeroInstance *h, si32 structureInstanceID) const; //hero must be visiting or garrisoned in town