feat(Core/Travel): Port TravelPath::cutTo for upcoming special-movement handling

This commit is contained in:
bash 2026-05-30 21:41:34 +02:00
parent 0c9131692c
commit 77c5c6d8cd
2 changed files with 18 additions and 0 deletions

View File

@ -706,6 +706,18 @@ bool TravelPath::IsPathCheating(std::vector<WorldPosition> 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())

View File

@ -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<WorldPosition> const& path,