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

NewTurn::applyGs: update bonuses in beginning. Fix issue 2083

Before bonuses was removed after hero get movement points and mana so affected hero one day more than intended.
This commit is contained in:
Arseniy Shestakov
2015-12-25 01:46:44 +03:00
parent 8eb4f14ff0
commit 66e6f15e67

View File

@ -1010,6 +1010,13 @@ DLL_LINKAGE void SetAvailableArtifacts::applyGs( CGameState *gs )
DLL_LINKAGE void NewTurn::applyGs( CGameState *gs )
{
gs->day = day;
// Update bonuses before doing anything else so hero don't get more MP than needed
gs->globalEffects.popBonuses(Bonus::OneDay); //works for children -> all game objs
gs->globalEffects.updateBonuses(Bonus::NDays);
gs->globalEffects.updateBonuses(Bonus::OneWeek);
//TODO not really a single root hierarchy, what about bonuses placed elsewhere? [not an issue with H3 mechanics but in the future...]
for(NewTurn::Hero h : heroes) //give mana/movement point
{
CGHeroInstance *hero = gs->getHero(h.id);
@ -1026,11 +1033,6 @@ DLL_LINKAGE void NewTurn::applyGs( CGameState *gs )
for(auto creatureSet : cres) //set available creatures in towns
creatureSet.second.applyGs(gs);
gs->globalEffects.popBonuses(Bonus::OneDay); //works for children -> all game objs
gs->globalEffects.updateBonuses(Bonus::NDays);
gs->globalEffects.updateBonuses(Bonus::OneWeek);
//TODO not really a single root hierarchy, what about bonuses placed elsewhere? [not an issue with H3 mechanics but in the future...]
for(CGTownInstance* t : gs->map->towns)
t->builded = 0;