Pārlūkot izejas kodu

CPathfinder: avoid pathing through hero standing on Subterranean Gate

Subterranean Gates unlike Monolith allow to visit hero standing on other exit. So of course pathfinder allowed that, but it's also allowed future movement through that hero which caused infinite loop for AI.
ArseniyShestakov 10 gadi atpakaļ
vecāks
revīzija
c3e5231146
1 mainītis faili ar 9 papildinājumiem un 2 dzēšanām
  1. 9 2
      lib/CPathfinder.cpp

+ 9 - 2
lib/CPathfinder.cpp

@@ -195,8 +195,15 @@ void CPathfinder::calculatePaths()
 				dp->moveRemains = movement;
 				dp->turns = turn;
 				dp->theNodeBefore = cp;
-				dp->action = CGPathNode::NORMAL;
-				pq.push(dp);
+
+				dtObj = gs->map->getTile(neighbour).topVisitableObj();
+				if(CGTeleport::isTeleport(dtObj))
+				{
+					dp->action = CGPathNode::NORMAL;
+					pq.push(dp);
+				}
+				else
+					dp->action = getDestAction(); // TODO: We only need to check for hero on other side, but not for guards.
 			}
 		}
 	} //queue loop