mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 23:49:25 +02:00
fix(Core/Travel): Reject NOT_USING_PATH shortcuts in chained probe (cmangos parity)
This commit is contained in:
parent
cbba63acd1
commit
e60e5add9c
@ -739,14 +739,23 @@ std::vector<WorldPosition> WorldPosition::getPathStepFrom(WorldPosition startPos
|
|||||||
if (tempCreature)
|
if (tempCreature)
|
||||||
delete tempCreature;
|
delete tempCreature;
|
||||||
|
|
||||||
// PathType is a bitmask (PathGenerator.h). Detour can return e.g.
|
// PathType is a bitmask. Two things to handle:
|
||||||
// PATHFIND_INCOMPLETE | PATHFIND_FARFROMPOLY_END (0x84) when the
|
//
|
||||||
// destination is a few yards off the nearest polygon — a strict
|
// 1. AC's PathGenerator can return INCOMPLETE | FARFROMPOLY_END
|
||||||
// `== PATHFIND_INCOMPLETE` check would reject the perfectly usable
|
// (0x84) etc. — strict `== PATHFIND_INCOMPLETE` would reject
|
||||||
// partial path and the chained probe would terminate empty on the
|
// these perfectly usable partial paths. Use bitwise to accept
|
||||||
// very first call. PathGenerator's own internal code uses bitwise
|
// NORMAL/INCOMPLETE plus auxiliary flags.
|
||||||
// tests like `!(_type & PATHFIND_INCOMPLETE)`.
|
//
|
||||||
if (type & (PATHFIND_NORMAL | PATHFIND_INCOMPLETE))
|
// 2. AC's PathGenerator at PathGenerator.cpp:177-188 returns
|
||||||
|
// NORMAL | NOT_USING_PATH for player units when start or end
|
||||||
|
// polygon is INVALID_POLYREF (BuildShortcut → 2-point straight
|
||||||
|
// line through whatever's in the way). cmangos by contrast
|
||||||
|
// returns NOPATH for the same case (PathFinder.cpp:437-441).
|
||||||
|
// To match cmangos's intent (never silently dispatch a
|
||||||
|
// geometry-ignoring shortcut), reject any path with the
|
||||||
|
// NOT_USING_PATH bit set.
|
||||||
|
if ((type & (PATHFIND_NORMAL | PATHFIND_INCOMPLETE))
|
||||||
|
&& !(type & PATHFIND_NOT_USING_PATH))
|
||||||
return fromPointsArray(points);
|
return fromPointsArray(points);
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user