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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user