فهرست منبع

Fix Admiral's Hat whirlpool immunity. Reduce usage of
convertFromVisitablePos

Ivan Savenko 1 سال پیش
والد
کامیت
9c05e80315
4فایلهای تغییر یافته به همراه10 افزوده شده و 12 حذف شده
  1. 1 1
      AI/Nullkiller/AIGateway.cpp
  2. 1 1
      AI/VCAI/VCAI.cpp
  3. 1 3
      client/HeroMovementController.cpp
  4. 7 7
      lib/mapObjects/MiscObjects.cpp

+ 1 - 1
AI/Nullkiller/AIGateway.cpp

@@ -1321,7 +1321,7 @@ bool AIGateway::moveHeroToTile(int3 dst, HeroPtr h)
 		{
 			destinationTeleport = exitId;
 			if(exitPos.valid())
-				destinationTeleportPos = h->convertFromVisitablePos(exitPos);
+				destinationTeleportPos = exitPos;
 			cb->moveHero(*h, h->pos, false);
 			destinationTeleport = ObjectInstanceID();
 			destinationTeleportPos = int3(-1);

+ 1 - 1
AI/VCAI/VCAI.cpp

@@ -1899,7 +1899,7 @@ bool VCAI::moveHeroToTile(int3 dst, HeroPtr h)
 		{
 			destinationTeleport = exitId;
 			if(exitPos.valid())
-				destinationTeleportPos = h->convertFromVisitablePos(exitPos);
+				destinationTeleportPos = exitPos;
 			cb->moveHero(*h, h->pos, false);
 			destinationTeleport = ObjectInstanceID();
 			destinationTeleportPos = int3(-1);

+ 1 - 3
client/HeroMovementController.cpp

@@ -90,9 +90,7 @@ void HeroMovementController::showTeleportDialog(const CGHeroInstance * hero, Tel
 
 	for(size_t i = 0; i < exits.size(); ++i)
 	{
-		const auto * teleporter = LOCPLINT->cb->getObj(exits[i].first);
-
-		if(teleporter && teleporter->visitableAt(nextNode.coord))
+		if(exits[i].second == nextNode.coord)
 		{
 			// Remove this node from path - it will be covered by teleportation
 			//LOCPLINT->localState->removeLastNode(hero);

+ 7 - 7
lib/mapObjects/MiscObjects.cpp

@@ -490,7 +490,7 @@ void CGMonolith::onHeroVisit( const CGHeroInstance * h ) const
 			auto exits = cb->getTeleportChannelExits(channel);
 			for(const auto & exit : exits)
 			{
-				td.exits.push_back(std::make_pair(exit, h->convertFromVisitablePos(cb->getObj(exit)->visitablePos())));
+				td.exits.push_back(std::make_pair(exit, cb->getObj(exit)->visitablePos()));
 			}
 		}
 
@@ -522,9 +522,9 @@ void CGMonolith::teleportDialogAnswered(const CGHeroInstance *hero, ui32 answer,
 	else if(vstd::isValidIndex(exits, answer))
 		dPos = exits[answer].second;
 	else
-		dPos = hero->convertFromVisitablePos(cb->getObj(randomExit)->visitablePos());
+		dPos = cb->getObj(randomExit)->visitablePos();
 
-	cb->moveHero(hero->id, dPos, EMovementMode::MONOLITH);
+	cb->moveHero(hero->id, hero->convertFromVisitablePos(dPos), EMovementMode::MONOLITH);
 }
 
 void CGMonolith::initObj(CRandomGenerator & rand)
@@ -566,7 +566,7 @@ void CGSubterraneanGate::onHeroVisit( const CGHeroInstance * h ) const
 	else
 	{
 		auto exit = getRandomExit(h);
-		td.exits.push_back(std::make_pair(exit, h->convertFromVisitablePos(cb->getObj(exit)->visitablePos())));
+		td.exits.push_back(std::make_pair(exit, cb->getObj(exit)->visitablePos()));
 	}
 
 	cb->showTeleportDialog(&td);
@@ -676,7 +676,7 @@ void CGWhirlpool::onHeroVisit( const CGHeroInstance * h ) const
 		{
 			auto blockedPosList = cb->getObj(exit)->getBlockedPos();
 			for(const auto & bPos : blockedPosList)
-				td.exits.push_back(std::make_pair(exit, h->convertFromVisitablePos(bPos)));
+				td.exits.push_back(std::make_pair(exit, bPos));
 		}
 	}
 
@@ -700,10 +700,10 @@ void CGWhirlpool::teleportDialogAnswered(const CGHeroInstance *hero, ui32 answer
 
 		const auto * obj = cb->getObj(exit);
 		std::set<int3> tiles = obj->getBlockedPos();
-		dPos = hero->convertFromVisitablePos(*RandomGeneratorUtil::nextItem(tiles, CRandomGenerator::getDefault()));
+		dPos = *RandomGeneratorUtil::nextItem(tiles, CRandomGenerator::getDefault());
 	}
 
-	cb->moveHero(hero->id, dPos, EMovementMode::MONOLITH);
+	cb->moveHero(hero->id, hero->convertFromVisitablePos(dPos), EMovementMode::MONOLITH);
 }
 
 bool CGWhirlpool::isProtected(const CGHeroInstance * h)