diff --git a/AI/Nullkiller/AIGateway.cpp b/AI/Nullkiller/AIGateway.cpp index 9e4a3f58d..795ddbd8a 100644 --- a/AI/Nullkiller/AIGateway.cpp +++ b/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); diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index 0926fab24..686afbbba 100644 --- a/AI/VCAI/VCAI.cpp +++ b/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); diff --git a/client/HeroMovementController.cpp b/client/HeroMovementController.cpp index 8c3ebe349..ca6311c6b 100644 --- a/client/HeroMovementController.cpp +++ b/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); diff --git a/lib/mapObjects/MiscObjects.cpp b/lib/mapObjects/MiscObjects.cpp index e4eaa39ad..598ff9787 100644 --- a/lib/mapObjects/MiscObjects.cpp +++ b/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 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)