Browse Source

Update DefenceBehavior.cpp

Stop iterating over tasks when the curent hero has been found in one.
Xilmi 10 tháng trước cách đây
mục cha
commit
2df9861076

+ 3 - 0
AI/Nullkiller/Behaviors/DefenceBehavior.cpp

@@ -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)