1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-10 00:43:59 +02:00

Update DefenceBehavior.cpp

Stop iterating over tasks when the curent hero has been found in one.
This commit is contained in:
Xilmi 2024-12-01 23:05:56 +01:00
parent 1d79946825
commit 2df9861076

View File

@ -425,7 +425,10 @@ void DefenceBehavior::evaluateRecruitingHero(Goals::TGoalVec & tasks, const HitM
if (auto recruitGoal = dynamic_cast<Goals::RecruitHero*>(task.get())) if (auto recruitGoal = dynamic_cast<Goals::RecruitHero*>(task.get()))
{ {
if (recruitGoal->getHero() == hero) if (recruitGoal->getHero() == hero)
{
heroAlreadyHiredInOtherTown = true; heroAlreadyHiredInOtherTown = true;
break;
}
} }
} }
if (heroAlreadyHiredInOtherTown) if (heroAlreadyHiredInOtherTown)