Core/MMaps: Handle path on same position

Handle path on the same polygon between 2 very close positions as a normal path.
This commit is contained in:
jackpoz authored and Ovahlord committed 2020-02-20 21:36:13 +01:00
1 parent 9c6514847f
commit e9318828b5
1 file changed
+8 -1
+8 -1
View File
@@ -547,7 +547,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