Prechádzať zdrojové kódy

CPathfinder: improve support for whirlpools

ArseniyShestakov 10 rokov pred
rodič
commit
942c0cd718
1 zmenil súbory, kde vykonal 10 pridanie a 1 odobranie
  1. 10 1
      lib/CPathfinder.cpp

+ 10 - 1
lib/CPathfinder.cpp

@@ -248,7 +248,16 @@ void CPathfinder::addTeleportExits(bool noTeleportExcludes)
 		for(auto objId : gs->getTeleportChannelExits(sTileTeleport->channel, hero->tempOwner))
 		{
 			auto obj = getObj(objId);
-			if(CGTeleport::isExitPassable(gs, hero, obj))
+			if(dynamic_cast<const CGWhirlpool *>(obj))
+			{
+				auto pos = obj->getBlockedPos();
+				for(auto p : pos)
+				{
+					if(gs->getTile(p)->topVisitableId() == obj->ID)
+						neighbours.push_back(p);
+				}
+			}
+			else if(CGTeleport::isExitPassable(gs, hero, obj))
 				neighbours.push_back(obj->visitablePos());
 		}
 	}