|
@@ -109,12 +109,18 @@ CGHeroInstance * TavernHeroesPool::takeHeroFromPool(HeroTypeID hero)
|
|
|
|
|
|
|
|
void TavernHeroesPool::onNewDay()
|
|
void TavernHeroesPool::onNewDay()
|
|
|
{
|
|
{
|
|
|
|
|
+ auto unusedHeroes = unusedHeroesFromPool();
|
|
|
|
|
+
|
|
|
for(auto & hero : heroesPool)
|
|
for(auto & hero : heroesPool)
|
|
|
{
|
|
{
|
|
|
assert(hero.second);
|
|
assert(hero.second);
|
|
|
if(!hero.second)
|
|
if(!hero.second)
|
|
|
continue;
|
|
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->setMovementPoints(hero.second->movementPointsLimit(true));
|
|
|
hero.second->mana = hero.second->manaLimit();
|
|
hero.second->mana = hero.second->manaLimit();
|
|
|
}
|
|
}
|