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

Fix 2406 reset potentially available heroes

This commit is contained in:
Vadim Markovtsev
2016-01-28 22:48:51 +03:00
parent a7059fe681
commit 22fc4fd3e9
2 changed files with 38 additions and 0 deletions

View File

@@ -1057,6 +1057,23 @@ DLL_LINKAGE void NewTurn::applyGs( CGameState *gs )
for(NewTurn::Hero h : heroes) //give mana/movement point
{
CGHeroInstance *hero = gs->getHero(h.id);
if(!hero)
{
// retreated or surrendered hero who has not been reset yet
for(auto& hp : gs->hpool.heroesPool)
{
if(hp.second->id == h.id)
{
hero = hp.second;
break;
}
}
}
if(!hero)
{
logGlobal->errorStream() << "Hero " << h.id << " not found in NewTurn::applyGs";
continue;
}
hero->movement = h.move;
hero->mana = h.mana;
}