1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

generate at least one resource / creature

This commit is contained in:
Laserlicht 2024-07-26 00:55:47 +02:00 committed by GitHub
parent 652e2ddf3f
commit 977d8e041a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -1269,7 +1269,10 @@ int GrowthInfo::totalGrowth() const
for(const Entry &entry : entries)
ret += entry.count;
return ret * percent / 100;
auto retCalc = ret * percent / 100;
if(retCalc == 0 && ret > 0) //generate at least one
retCalc = 1;
return retCalc;
}
void CGTownInstance::fillUpgradeInfo(UpgradeInfo & info, const CStackInstance &stack) const

View File

@ -199,6 +199,9 @@ ui32 CGMine::defaultResProduction() const
ui32 CGMine::getProducedQuantity() const
{
auto * playerSettings = cb->getPlayerSettings(getOwner());
auto ret = producedQuantity * playerSettings->handicap.percentIncome / 100;
if(ret == 0 && producedQuantity > 0) // create at least 1 resource
ret = 1;
return producedQuantity * playerSettings->handicap.percentIncome / 100;
}