1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Moved most of daily income handling to a separate method

This commit is contained in:
Ivan Savenko
2024-08-24 19:18:15 +00:00
parent 58da447f43
commit 189cb1c762
8 changed files with 204 additions and 123 deletions

View File

@@ -1916,11 +1916,10 @@ void NewTurn::applyGs(CGameState *gs)
gs->heroesPool->onNewDay();
for(const auto & re : res)
for(const auto & entry : playerIncome)
{
assert(re.first.isValidPlayer());
gs->getPlayerState(re.first)->resources = re.second;
gs->getPlayerState(re.first)->resources.amin(GameConstants::PLAYER_RESOURCES_CAP);
gs->getPlayerState(entry.first)->resources += entry.second;
gs->getPlayerState(entry.first)->resources.amin(GameConstants::PLAYER_RESOURCES_CAP);
}
for(auto & creatureSet : cres) //set available creatures in towns