mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Do not evaluate goals related to removed hero
This commit is contained in:
parent
5693e72442
commit
d5063e53a0
@ -2825,6 +2825,30 @@ void VCAI::lostHero(HeroPtr h)
|
||||
{
|
||||
vstd::erase_if_present(heroVec.second, h);
|
||||
}
|
||||
|
||||
//remove goals with removed hero assigned from main loop
|
||||
vstd::erase_if(ultimateGoalsFromBasic, [&](const std::pair<Goals::TSubgoal, Goals::TGoalVec> & x) -> bool
|
||||
{
|
||||
if(x.first->hero == h)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
});
|
||||
|
||||
auto removedHeroGoalPredicate = [&](const Goals::TSubgoal & x) ->bool
|
||||
{
|
||||
if(x->hero == h)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
};
|
||||
|
||||
vstd::erase_if(basicGoals, removedHeroGoalPredicate);
|
||||
vstd::erase_if(goalsToAdd, removedHeroGoalPredicate);
|
||||
vstd::erase_if(goalsToRemove, removedHeroGoalPredicate);
|
||||
|
||||
for(auto goal : ultimateGoalsFromBasic)
|
||||
vstd::erase_if(goal.second, removedHeroGoalPredicate);
|
||||
}
|
||||
|
||||
void VCAI::answerQuery(QueryID queryID, int selection)
|
||||
|
Loading…
Reference in New Issue
Block a user