소스 검색

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