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

More work on VCAI Goals, still derived functions are not called :/

This commit is contained in:
DjWarmonger
2013-11-23 12:30:10 +00:00
parent 3e4407593f
commit e6bb39d3a4
4 changed files with 70 additions and 62 deletions

View File

@ -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.at(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.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));
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.at(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.at(build) && town->buildings.at(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;