mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-03 00:46:55 +02:00
const-ified CTown. May fix #1444
This commit is contained in:
@ -2896,7 +2896,7 @@ std::string CBattleInterface::SiegeHelper::getSiegeName(ui16 what, int state) co
|
|||||||
return 1;
|
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());
|
std::string addit = boost::lexical_cast<std::string>(getImageIndex());
|
||||||
|
|
||||||
switch(what)
|
switch(what)
|
||||||
|
@ -126,7 +126,7 @@ struct DLL_LINKAGE InfoAboutTown : public InfoAboutArmy
|
|||||||
|
|
||||||
} *details;
|
} *details;
|
||||||
|
|
||||||
CTown *tType;
|
const CTown *tType;
|
||||||
|
|
||||||
si32 built;
|
si32 built;
|
||||||
si32 fortLevel; //0 - none
|
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)
|
GrowthInfo::Entry::Entry(int subID, BuildingID building, int _count)
|
||||||
: count(_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()
|
CTownAndVisitingHero::CTownAndVisitingHero()
|
||||||
|
@ -586,7 +586,7 @@ public:
|
|||||||
enum EFortLevel {NONE = 0, FORT = 1, CITADEL = 2, CASTLE = 3};
|
enum EFortLevel {NONE = 0, FORT = 1, CITADEL = 2, CASTLE = 3};
|
||||||
|
|
||||||
CTownAndVisitingHero townAndVis;
|
CTownAndVisitingHero townAndVis;
|
||||||
CTown * town;
|
const CTown * town;
|
||||||
std::string name; // name of town
|
std::string name; // name of town
|
||||||
si32 builded; //how many buildings has been built this turn
|
si32 builded; //how many buildings has been built this turn
|
||||||
si32 destroyed; //how many buildings has been destroyed this turn
|
si32 destroyed; //how many buildings has been destroyed this turn
|
||||||
|
@ -37,18 +37,18 @@ BuildingID CBuilding::getBase() const
|
|||||||
{
|
{
|
||||||
const CBuilding * build = this;
|
const CBuilding * build = this;
|
||||||
while (build->upgrade >= 0)
|
while (build->upgrade >= 0)
|
||||||
build = build->town->buildings[build->upgrade];
|
build = build->town->buildings.at(build->upgrade);
|
||||||
|
|
||||||
return build->bid;
|
return build->bid;
|
||||||
}
|
}
|
||||||
|
|
||||||
si32 CBuilding::getDistance(BuildingID buildID) const
|
si32 CBuilding::getDistance(BuildingID buildID) const
|
||||||
{
|
{
|
||||||
const CBuilding * build = town->buildings[buildID];
|
const CBuilding * build = town->buildings.at(buildID);
|
||||||
int distance = 0;
|
int distance = 0;
|
||||||
while (build->upgrade >= 0 && build != this)
|
while (build->upgrade >= 0 && build != this)
|
||||||
{
|
{
|
||||||
build = build->town->buildings[build->upgrade];
|
build = build->town->buildings.at(build->upgrade);
|
||||||
distance++;
|
distance++;
|
||||||
}
|
}
|
||||||
if (build == this)
|
if (build == this)
|
||||||
|
@ -143,7 +143,7 @@ public:
|
|||||||
std::vector<std::string> dwellingNames;
|
std::vector<std::string> dwellingNames;
|
||||||
|
|
||||||
// should be removed at least from configs in favor of auto-detection
|
// 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
|
ui32 mageLevel; //max available mage guild level
|
||||||
ui16 primaryRes;
|
ui16 primaryRes;
|
||||||
ArtifactID warMachine;
|
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);
|
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)
|
if(!pom)
|
||||||
return EBuildingState::BUILDING_ERROR;
|
return EBuildingState::BUILDING_ERROR;
|
||||||
|
Reference in New Issue
Block a user