mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-01 00:45:26 +02:00
two patches/pull requests from janisozaur
- replace our custom bmap with std::map::at() - compile fixes for editor
This commit is contained in:
@ -2112,13 +2112,13 @@ int CGTownInstance::creatureDwellingLevel(int dwelling) const
|
||||
if (!hasBuilt(BuildingID(BuildingID::DWELL_FIRST+dwelling+i*GameConstants::CREATURES_PER_TOWN)))
|
||||
return i-1;
|
||||
}
|
||||
}
|
||||
int CGTownInstance::getHordeLevel(const int & HID) const//HID - 0 or 1; returns creature level or -1 if that horde structure is not present
|
||||
{
|
||||
return town->hordeLvl[HID];
|
||||
}
|
||||
int CGTownInstance::creatureGrowth(const int & level) const
|
||||
{
|
||||
}
|
||||
int CGTownInstance::getHordeLevel(const int & HID) const//HID - 0 or 1; returns creature level or -1 if that horde structure is not present
|
||||
{
|
||||
return town->hordeLvl.at(HID);
|
||||
}
|
||||
int CGTownInstance::creatureGrowth(const int & level) const
|
||||
{
|
||||
return getGrowthInfo(level).totalGrowth();
|
||||
}
|
||||
|
||||
@ -2139,17 +2139,17 @@ GrowthInfo CGTownInstance::getGrowthInfo(int level) const
|
||||
|
||||
if (hasBuilt(BuildingID::CASTLE))
|
||||
ret.entries.push_back(GrowthInfo::Entry(subID, BuildingID::CASTLE, castleBonus = base));
|
||||
else if (hasBuilt(BuildingID::CITADEL))
|
||||
ret.entries.push_back(GrowthInfo::Entry(subID, BuildingID::CITADEL, castleBonus = base / 2));
|
||||
|
||||
if(town->hordeLvl[0] == level)//horde 1
|
||||
if(hasBuilt(BuildingID::HORDE_1))
|
||||
ret.entries.push_back(GrowthInfo::Entry(subID, BuildingID::HORDE_1, creature->hordeGrowth));
|
||||
|
||||
if(town->hordeLvl[1] == level)//horde 2
|
||||
if(hasBuilt(BuildingID::HORDE_2))
|
||||
ret.entries.push_back(GrowthInfo::Entry(subID, BuildingID::HORDE_2, creature->hordeGrowth));
|
||||
|
||||
else if (hasBuilt(BuildingID::CITADEL))
|
||||
ret.entries.push_back(GrowthInfo::Entry(subID, BuildingID::CITADEL, castleBonus = base / 2));
|
||||
|
||||
if(town->hordeLvl.at(0) == level)//horde 1
|
||||
if(hasBuilt(BuildingID::HORDE_1))
|
||||
ret.entries.push_back(GrowthInfo::Entry(subID, BuildingID::HORDE_1, creature->hordeGrowth));
|
||||
|
||||
if(town->hordeLvl.at(1) == level)//horde 2
|
||||
if(hasBuilt(BuildingID::HORDE_2))
|
||||
ret.entries.push_back(GrowthInfo::Entry(subID, BuildingID::HORDE_2, creature->hordeGrowth));
|
||||
|
||||
int dwellingBonus = 0;
|
||||
if(const PlayerState *p = cb->getPlayer(tempOwner, false))
|
||||
{
|
||||
@ -2617,13 +2617,13 @@ bool CGTownInstance::addBonusIfBuilt(BuildingID building, Bonus::BonusType type,
|
||||
|
||||
bool CGTownInstance::addBonusIfBuilt(BuildingID building, Bonus::BonusType type, int val, TPropagatorPtr & prop, int subtype /*= -1*/)
|
||||
{
|
||||
if(hasBuilt(building))
|
||||
{
|
||||
std::ostringstream descr;
|
||||
descr << town->buildings[building]->Name() << " ";
|
||||
if(val > 0)
|
||||
descr << "+";
|
||||
else if(val < 0)
|
||||
if(hasBuilt(building))
|
||||
{
|
||||
std::ostringstream descr;
|
||||
descr << town->buildings.at(building)->Name() << " ";
|
||||
if(val > 0)
|
||||
descr << "+";
|
||||
else if(val < 0)
|
||||
descr << "-";
|
||||
descr << val;
|
||||
|
||||
@ -2692,13 +2692,13 @@ bool CGTownInstance::armedGarrison() const
|
||||
|
||||
int CGTownInstance::getTownLevel() const
|
||||
{
|
||||
// count all buildings that are not upgrades
|
||||
return boost::range::count_if(builtBuildings, [&](const BuildingID & build)
|
||||
{
|
||||
return town->buildings[build] && town->buildings[build]->upgrade == -1;
|
||||
});
|
||||
}
|
||||
|
||||
// count all buildings that are not upgrades
|
||||
return boost::range::count_if(builtBuildings, [&](const BuildingID & build)
|
||||
{
|
||||
return town->buildings.at(build) && town->buildings.at(build)->upgrade == -1;
|
||||
});
|
||||
}
|
||||
|
||||
CBonusSystemNode * CGTownInstance::whatShouldBeAttached()
|
||||
{
|
||||
return &townAndVis;
|
||||
|
Reference in New Issue
Block a user