mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
const-ified CTown. May fix #1444
This commit is contained in:
parent
dd72261193
commit
76c77d58f6
@ -2896,7 +2896,7 @@ std::string CBattleInterface::SiegeHelper::getSiegeName(ui16 what, int state) co
|
||||
return 1;
|
||||
};
|
||||
|
||||
std::string & prefix = town->town->clientInfo.siegePrefix;
|
||||
const std::string & prefix = town->town->clientInfo.siegePrefix;
|
||||
std::string addit = boost::lexical_cast<std::string>(getImageIndex());
|
||||
|
||||
switch(what)
|
||||
|
@ -126,7 +126,7 @@ struct DLL_LINKAGE InfoAboutTown : public InfoAboutArmy
|
||||
|
||||
} *details;
|
||||
|
||||
CTown *tType;
|
||||
const CTown *tType;
|
||||
|
||||
si32 built;
|
||||
si32 fortLevel; //0 - none
|
||||
|
@ -7471,7 +7471,7 @@ GrowthInfo::Entry::Entry(const std::string &format, int _count)
|
||||
GrowthInfo::Entry::Entry(int subID, BuildingID building, int _count)
|
||||
: count(_count)
|
||||
{
|
||||
description = boost::str(boost::format("%s %+d") % VLC->townh->factions[subID]->town->buildings[building]->Name() % count);
|
||||
description = boost::str(boost::format("%s %+d") % VLC->townh->factions[subID]->town->buildings.at(building)->Name() % count);
|
||||
}
|
||||
|
||||
CTownAndVisitingHero::CTownAndVisitingHero()
|
||||
|
@ -586,7 +586,7 @@ public:
|
||||
enum EFortLevel {NONE = 0, FORT = 1, CITADEL = 2, CASTLE = 3};
|
||||
|
||||
CTownAndVisitingHero townAndVis;
|
||||
CTown * town;
|
||||
const CTown * town;
|
||||
std::string name; // name of town
|
||||
si32 builded; //how many buildings has been built this turn
|
||||
si32 destroyed; //how many buildings has been destroyed this turn
|
||||
|
@ -37,18 +37,18 @@ BuildingID CBuilding::getBase() const
|
||||
{
|
||||
const CBuilding * build = this;
|
||||
while (build->upgrade >= 0)
|
||||
build = build->town->buildings[build->upgrade];
|
||||
build = build->town->buildings.at(build->upgrade);
|
||||
|
||||
return build->bid;
|
||||
}
|
||||
|
||||
si32 CBuilding::getDistance(BuildingID buildID) const
|
||||
{
|
||||
const CBuilding * build = town->buildings[buildID];
|
||||
const CBuilding * build = town->buildings.at(buildID);
|
||||
int distance = 0;
|
||||
while (build->upgrade >= 0 && build != this)
|
||||
{
|
||||
build = build->town->buildings[build->upgrade];
|
||||
build = build->town->buildings.at(build->upgrade);
|
||||
distance++;
|
||||
}
|
||||
if (build == this)
|
||||
|
@ -143,7 +143,7 @@ public:
|
||||
std::vector<std::string> dwellingNames;
|
||||
|
||||
// should be removed at least from configs in favor of auto-detection
|
||||
std::map<int,int> hordeLvl; //[0] - first horde building creature level; [1] - second horde building (-1 if not present)
|
||||
bmap<int,int> hordeLvl; //[0] - first horde building creature level; [1] - second horde building (-1 if not present)
|
||||
ui32 mageLevel; //max available mage guild level
|
||||
ui16 primaryRes;
|
||||
ArtifactID warMachine;
|
||||
|
@ -567,7 +567,7 @@ EBuildingState::EBuildingState CGameInfoCallback::canBuildStructure( const CGTow
|
||||
{
|
||||
ERROR_RET_VAL_IF(!canGetFullInfo(t), "Town is not owned!", EBuildingState::TOWN_NOT_OWNED);
|
||||
|
||||
CBuilding * pom = t->town->buildings[ID];
|
||||
const CBuilding * pom = t->town->buildings[ID];
|
||||
|
||||
if(!pom)
|
||||
return EBuildingState::BUILDING_ERROR;
|
||||
|
Loading…
Reference in New Issue
Block a user