1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

code review

This commit is contained in:
Laserlicht
2024-07-29 22:54:42 +02:00
parent 6adc49b814
commit 3e5df61946
13 changed files with 49 additions and 45 deletions

View File

@ -199,10 +199,8 @@ 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 ret;
// always round up income - we don't want mines to always produce zero if handicap in use
return (producedQuantity * playerSettings->handicap.percentIncome + 99) / 100;
}
void CGMine::battleFinished(const CGHeroInstance *hero, const BattleResult &result) const