mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
feat(Core/Travel): Port TravelPath::cutTo for upcoming special-movement handling
This commit is contained in:
parent
13b10e5d20
commit
052b8de95c
@ -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())
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user