From f85e6568d0fe177a78cf14bc24b3666d66332335 Mon Sep 17 00:00:00 2001 From: bash Date: Sat, 30 May 2026 19:05:00 +0200 Subject: [PATCH] fix(Core/Travel): mmap-path startPath and endPath in GetFullPath --- src/Mgr/Travel/TravelNode.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/Mgr/Travel/TravelNode.cpp b/src/Mgr/Travel/TravelNode.cpp index 1bf46fb45..4d5a77c0b 100644 --- a/src/Mgr/Travel/TravelNode.cpp +++ b/src/Mgr/Travel/TravelNode.cpp @@ -1290,8 +1290,33 @@ bool TravelNodeMap::GetFullPath(TravelPlan& plan, if (route.isEmpty()) return false; + WorldPosition startNodePos = *startNode->getPosition(); + WorldPosition endNodePos = *endNode->getPosition(); + + // pathToStart: mmap-path from bot to the first node — without this + // the executor's NODE_PREPATH walks a 2-point straight line and can + // tunnel through terrain to reach the first node. std::vector pathToStart = {botPos}; + if (bot && botPos.GetMapId() == startNodePos.GetMapId()) + { + std::vector probe = botPos.getPathTo(startNodePos, bot); + if (probe.size() >= 2) + pathToStart = probe; + } + + // pathToEnd: mmap-path from the last node to the destination — without + // this the route ends at lastNode and the bot stops short of dest. + // Cross-map case: bot can't mmap-query the destination map; the + // single-point fallback gets re-resolved per-tick once bot crosses. std::vector pathToEnd = {destination}; + if (bot && botPos.GetMapId() == endNodePos.GetMapId() && + botPos.GetMapId() == destination.GetMapId()) + { + std::vector probe = endNodePos.getPathTo(destination, bot); + if (probe.size() >= 2) + pathToEnd = probe; + } + plan.steps = route.BuildPath(pathToStart, pathToEnd, nullptr); return !plan.steps.empty();