mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
Added "produce" section in "building" structure. Changed dailyIncome.
This commit is contained in:
@ -2179,6 +2179,7 @@ CGTownInstance::EFortLevel CGTownInstance::fortLevel() const //0 - none, 1 - for
|
||||
|
||||
int CGTownInstance::hallLevel() const // -1 - none, 0 - village, 1 - town, 2 - city, 3 - capitol
|
||||
{
|
||||
|
||||
if (hasBuilt(BuildingID::CAPITOL))
|
||||
return 3;
|
||||
if (hasBuilt(BuildingID::CITY_HALL))
|
||||
@ -2269,22 +2270,47 @@ GrowthInfo CGTownInstance::getGrowthInfo(int level) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
int CGTownInstance::dailyIncome() const
|
||||
TResources CGTownInstance::dailyIncome() const
|
||||
{
|
||||
int ret = 0;
|
||||
if (hasBuilt(BuildingID::GRAIL))
|
||||
ret+=5000;
|
||||
TResources ret;
|
||||
for (auto i = Res::WOOD; i <= Res::GOLD; vstd::advance(i, 1))
|
||||
{
|
||||
ret[i] = 0;
|
||||
}
|
||||
BOOST_FOREACH(TPairCBuilding p, town->buildings)
|
||||
{
|
||||
BuildingID buildingUpgrade;
|
||||
BOOST_FOREACH(TPairCBuilding p2, town->buildings)
|
||||
{
|
||||
if (p2.second->upgrade == p.first)
|
||||
{
|
||||
buildingUpgrade = p2.first;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasBuilt(BuildingID::CAPITOL))
|
||||
ret+=4000;
|
||||
else if (hasBuilt(BuildingID::CITY_HALL))
|
||||
ret+=2000;
|
||||
else if (hasBuilt(BuildingID::TOWN_HALL))
|
||||
ret+=1000;
|
||||
else if (hasBuilt(BuildingID::VILLAGE_HALL))
|
||||
ret+=500;
|
||||
if (hasBuilt(BuildingID::RESOURCE_SILO)&&(town->primaryRes==Res::GOLD))
|
||||
ret += 500;
|
||||
if (!hasBuilt(buildingUpgrade)&&(hasBuilt(p.first)))
|
||||
{
|
||||
for (auto i = Res::WOOD; i <= Res::GOLD; vstd::advance(i, 1))
|
||||
{
|
||||
ret[i] += p.second->produce[i];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if (hasBuilt(BuildingID::GRAIL))
|
||||
// ret+=5000;
|
||||
|
||||
// if (hasBuilt(BuildingID::CAPITOL))
|
||||
// ret+=4000;
|
||||
// else if (hasBuilt(BuildingID::CITY_HALL))
|
||||
// ret+=2000;
|
||||
// else if (hasBuilt(BuildingID::TOWN_HALL))
|
||||
// ret+=1000;
|
||||
// else if (hasBuilt(BuildingID::VILLAGE_HALL))
|
||||
// ret+=500;
|
||||
// if (hasBuilt(BuildingID::RESOURCE_SILO)&&(town->primaryRes==Res::GOLD))
|
||||
// ret += 500;
|
||||
return ret;
|
||||
}
|
||||
bool CGTownInstance::hasFort() const
|
||||
|
Reference in New Issue
Block a user