From 77caf85fd1c3b1e34f0436763d6595d7498f9ae4 Mon Sep 17 00:00:00 2001 From: bash Date: Mon, 18 May 2026 01:14:14 +0200 Subject: [PATCH] fix(Core/Travel): Reject 2-point BuildShortcut paths between non-adjacent nodes --- src/Mgr/Travel/TravelMgr.cpp | 9 --------- src/Mgr/Travel/TravelNode.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Mgr/Travel/TravelMgr.cpp b/src/Mgr/Travel/TravelMgr.cpp index bdef7394a..7d287e824 100644 --- a/src/Mgr/Travel/TravelMgr.cpp +++ b/src/Mgr/Travel/TravelMgr.cpp @@ -752,15 +752,6 @@ std::vector WorldPosition::getPathStepFrom(WorldPosition startPos std::vector retvec = fromPointsArray(points); - // PathGenerator can also return PATHFIND_NORMAL with just two - // points (start + end) as a fallback when polygon search fails - // partway through — effectively a teleport across whatever lies - // between. Reject long 2-point segments to avoid the chained - // probe accepting a 1000y+ "shortcut" as a valid path step. - // 75y matches the nodeFirstDis travelnode threshold elsewhere. - if (retvec.size() == 2 && retvec.front().distance(&retvec.back()) > 75.0f) - return {}; - // Underwater path-extension. When PATHFIND_INCOMPLETE ends within // 50y of dest and both endpoints are underwater with LOS, extend // by one 5y step (or straight to dest if <5y). Lets bots traverse diff --git a/src/Mgr/Travel/TravelNode.cpp b/src/Mgr/Travel/TravelNode.cpp index 2bb5468ba..0bd730c89 100644 --- a/src/Mgr/Travel/TravelNode.cpp +++ b/src/Mgr/Travel/TravelNode.cpp @@ -226,6 +226,12 @@ TravelNodePath* TravelNode::BuildPath(TravelNode* endNode, Unit* bot, bool postP bool canPath = endPos->isPathTo(path); // Check if we reached our destination. + // Reject 2-point paths between non-adjacent nodes — that's + // PathGenerator's BuildShortcut fallback "teleporting" the chain + // endpoint across whatever lies between, not a real walkable route. + if (canPath && path.size() == 2 && getPosition()->distance(endNode->getPosition()) > 5.0f) + canPath = false; + // Reject too-short or too-steep results — geometry shortcut that // mmap returns but a player can't actually walk. if (canPath && TravelPath::IsPathCheating(path, getPosition()->distance(endNode->getPosition())))