From d293dd37822d93f9023d3ff9d39052ed976e236b Mon Sep 17 00:00:00 2001 From: jackpoz Date: Mon, 20 Jan 2020 19:46:01 +0100 Subject: Core/MMaps: Handle path on same position Handle path on the same polygon between 2 very close positions as a normal path. --- src/server/game/Movement/PathGenerator.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Movement/PathGenerator.cpp b/src/server/game/Movement/PathGenerator.cpp index 56ba2693f7b..6318f952d5d 100644 --- a/src/server/game/Movement/PathGenerator.cpp +++ b/src/server/game/Movement/PathGenerator.cpp @@ -528,7 +528,14 @@ void PathGenerator::BuildPointPath(const float *startPoint, const float *endPoin _pointPathLimit); // maximum number of points } - if (pointCount < 2 || dtStatusFailed(dtResult)) + // Special case with start and end positions very close to each other + if (_polyLength == 1 && pointCount == 1) + { + // First point is start position, append end position + dtVcopy(&pathPoints[1 * VERTEX_SIZE], endPoint); + pointCount++; + } + else if ( pointCount < 2 || dtStatusFailed(dtResult)) { // only happens if pass bad data to findStraightPath or navmesh is broken // single point paths can be generated here -- cgit v1.2.3