Преглед на файлове

AI should poke inaccessible Quest Guards less often.

DjWarmonger преди 10 години
родител
ревизия
87f838f286
променени са 2 файла, в които са добавени 5 реда и са изтрити 3 реда
  1. 1 1
      AI/VCAI/Goals.cpp
  2. 4 2
      AI/VCAI/VCAI.cpp

+ 1 - 1
AI/VCAI/Goals.cpp

@@ -518,10 +518,10 @@ TGoalVec ClearWayTo::getAllPossibleSubgoals()
 				{
 					//TODO: we should be able to return apriopriate quest here (VCAI::striveToQuest)
 					logAi->debugStream() << "Quest guard blocks the way to " + tile();
+					continue; //do not access quets guard if we can't complete the quest
 				}
 			}
 		}
-
 		if (isSafeToVisit(h, tileToHit)) //this makes sense only if tile is guarded, but there i no quest object
 		{
 			ret.push_back (sptr (Goals::VisitTile(tileToHit).sethero(h)));

+ 4 - 2
AI/VCAI/VCAI.cpp

@@ -2455,11 +2455,13 @@ void VCAI::buildArmyIn(const CGTownInstance * t)
 
 int3 VCAI::explorationBestNeighbour(int3 hpos, int radius, HeroPtr h)
 {
+	int3 ourPos = h->convertPosition(h->pos, false);
 	std::map<int3, int> dstToRevealedTiles;
 	for(crint3 dir : dirs)
 		if(cb->isInTheMap(hpos+dir))
-			if (isSafeToVisit(h, hpos + dir) && isAccessibleForHero (hpos + dir, h))
-				dstToRevealedTiles[hpos + dir] = howManyTilesWillBeDiscovered(radius, hpos, dir);
+			if (ourPos != dir) //don't stand in place
+				if (isSafeToVisit(h, hpos + dir) && isAccessibleForHero (hpos + dir, h))
+					dstToRevealedTiles[hpos + dir] = howManyTilesWillBeDiscovered(radius, hpos, dir);
 
 	if (dstToRevealedTiles.empty()) //yes, it DID happen!
 		throw cannotFulfillGoalException("No neighbour will bring new discoveries!");