1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Do not attempt to reset movement for inactive heroes in pool

This commit is contained in:
Ivan Savenko 2023-07-27 15:51:38 +03:00
parent 7b17c5ae18
commit 72210afc92

View File

@ -109,12 +109,18 @@ CGHeroInstance * TavernHeroesPool::takeHeroFromPool(HeroTypeID hero)
void TavernHeroesPool::onNewDay()
{
auto unusedHeroes = unusedHeroesFromPool();
for(auto & hero : heroesPool)
{
assert(hero.second);
if(!hero.second)
continue;
// do not access heroes who are not present in tavern of any players
if (vstd::contains(unusedHeroes, hero.first))
continue;
hero.second->setMovementPoints(hero.second->movementPointsLimit(true));
hero.second->mana = hero.second->manaLimit();
}