From 694ba0c64c6be5f5e07dbe1424059222fa144086 Mon Sep 17 00:00:00 2001 From: bash Date: Sun, 31 May 2026 00:42:19 +0200 Subject: [PATCH] =?UTF-8?q?fix(Core/Travel):=20Restore=20probe-first=20sho?= =?UTF-8?q?rt-circuit=20in=20GetFullPath=20=E2=80=94=20AC-side=20workaroun?= =?UTF-8?q?d=20for=20cave-interior=20destinations=20the=20graph=20misses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Mgr/Travel/TravelNode.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/Mgr/Travel/TravelNode.cpp b/src/Mgr/Travel/TravelNode.cpp index 44ba5f5bc..727c1767b 100644 --- a/src/Mgr/Travel/TravelNode.cpp +++ b/src/Mgr/Travel/TravelNode.cpp @@ -1712,6 +1712,35 @@ TravelPath TravelNodeMap::GetFullPath(WorldPosition botPos, [[maybe_unused]] uin { TravelPath path; + // AC-side workaround that reference doesn't have: if a 40-step mmap + // probe from bot to destination either reaches close (<30y) or makes + // meaningful progress (>50% AND >30y absolute), prefer that direct + // path over the graph. Restored because removing it broke + // destinations that the graph's K=5 endNode pick can't reach but + // raw mmap CAN (caves with interior navmesh that A* misses because + // the cave-interior node fails the strict 1y endPath validation). + if (botPos.GetMapId() == destination.GetMapId()) + { + std::vector probe = destination.getPathFromPath({botPos}, bot, 40); + if (probe.size() >= 2) + { + float const totalDist = botPos.distance(destination); + float const probeEndToDest = destination.distance(probe.back()); + float const probeProgress = totalDist - probeEndToDest; + + bool const closeEnough = probeEndToDest < 30.0f; + bool const meaningfulProgress = probeProgress > totalDist * 0.5f && probeProgress > 30.0f; + + if (closeEnough || meaningfulProgress) + { + path.addPoint(botPos, PathNodeType::NODE_PREPATH); + for (size_t i = 1; i < probe.size(); ++i) + path.addPoint(probe[i], PathNodeType::NODE_PATH); + return path; + } + } + } + std::shared_lock guard(m_nMapMtx); // Mirror reference: if the bot is mid-transport, the first valid