Browse Source

VCAI: finish fixing of teleport probing for whirlpools

ArseniyShestakov 10 years ago
parent
commit
791d1e7ab4
1 changed files with 4 additions and 4 deletions
  1. 4 4
      AI/VCAI/VCAI.cpp

+ 4 - 4
AI/VCAI/VCAI.cpp

@@ -1887,16 +1887,16 @@ bool VCAI::moveHeroToTile(int3 dst, HeroPtr h)
 
 		auto doChannelProbing = [&]() -> void
 		{
-			auto currentExit = getObj(CGHeroInstance::convertPosition(h->pos,false), false);
-			auto currentExitPos = CGHeroInstance::convertPosition(h->pos,false);
-			assert(currentExit);
+			auto currentPos = CGHeroInstance::convertPosition(h->pos,false);
+			auto currentExit = getObj(currentPos, true)->id;
 
 			status.setChannelProbing(true);
 			for(auto exit : teleportChannelProbingList)
 				doTeleportMovement(exit, int3(-1));
 			teleportChannelProbingList.clear();
-			doTeleportMovement(currentExit->id, currentExitPos);
 			status.setChannelProbing(false);
+
+			doTeleportMovement(currentExit, currentPos);
 		};
 
 		int i=path.nodes.size()-1;