From 052b8de95cede983d32b3a15687d9a08ed5d2885 Mon Sep 17 00:00:00 2001 From: bash Date: Sat, 30 May 2026 21:41:34 +0200 Subject: [PATCH] feat(Core/Travel): Port TravelPath::cutTo for upcoming special-movement handling --- src/Mgr/Travel/TravelNode.cpp | 12 ++++++++++++ src/Mgr/Travel/TravelNode.h | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/src/Mgr/Travel/TravelNode.cpp b/src/Mgr/Travel/TravelNode.cpp index 0ed50bd76..0773eb096 100644 --- a/src/Mgr/Travel/TravelNode.cpp +++ b/src/Mgr/Travel/TravelNode.cpp @@ -706,6 +706,18 @@ bool TravelPath::IsPathCheating(std::vector const& path, float en return false; } +bool TravelPath::cutTo(PathNodePoint point, bool including) +{ + auto it = std::find(fullPath.begin(), fullPath.end(), point); + + if (it == fullPath.end()) + return false; + + auto cutIt = including ? std::next(it) : it; + fullPath.erase(fullPath.begin(), cutIt); + return true; +} + bool TravelPath::makeShortCut(WorldPosition startPos, float maxDist, Unit* bot) { if (GetPath().empty()) diff --git a/src/Mgr/Travel/TravelNode.h b/src/Mgr/Travel/TravelNode.h index 316497af0..4fa7a20f5 100644 --- a/src/Mgr/Travel/TravelNode.h +++ b/src/Mgr/Travel/TravelNode.h @@ -492,6 +492,12 @@ public: bool makeShortCut(WorldPosition startPos, float maxDist, Unit* bot = nullptr); + // Trim the path up to (and optionally including) the given point. + // Returns true if the point was found. Used by upcoming special- + // movement detection to advance the path past a portal/transport/ + // area-trigger node once the bot reaches it. + bool cutTo(PathNodePoint point, bool including); + // Reject paths the navmesh accepts but a player can't walk: // 2-point shortcut over 5y, or > 10y vertical drop with slope steeper than 2:1. static bool IsPathCheating(std::vector const& path,