瀏覽代碼

Fixed heroes getting stuck because their assigned tile was captured by another hero.

DjWarmonger 12 年之前
父節點
當前提交
5ec3685041
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      AI/VCAI/Goals.cpp

+ 7 - 1
AI/VCAI/Goals.cpp

@@ -493,7 +493,13 @@ TGoalVec VisitTile::getAllPossibleSubgoals()
 		ret.push_back (sptr(Goals::Explore())); //what sense does it make?
 	else
 	{
-		for (auto h : cb->getHeroesInfo())
+		std::vector<const CGHeroInstance *> heroes;
+		if (hero)
+			heroes.push_back(hero.h); //use assigned hero if any
+		else
+			heroes = cb->getHeroesInfo(); //use most convenient hero
+
+		for (auto h : heroes)
 		{
 			if (ai->isAccessibleForHero(tile, h))
 				ret.push_back (sptr(Goals::VisitTile(tile).sethero(h)));