浏览代码

Update DefenceBehavior.cpp

Fixed an issue that caused the AI to try buying the same hero in two different towns.
Xilmi 11 月之前
父节点
当前提交
9d2fc1b1c9
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      AI/Nullkiller/Behaviors/DefenceBehavior.cpp

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

@@ -41,6 +41,9 @@ Goals::TGoalVec DefenceBehavior::decompose(const Nullkiller * ai) const
 	for(auto town : ai->cb->getTownsInfo())
 	{
 		evaluateDefence(tasks, town, ai);
+		//Let's do only one defence-task per pass since otherwise it can try to hire the same hero twice
+		if (!tasks.empty())
+			break;
 	}
 
 	return tasks;