From 46022ae734bcdfcab5bf6a2739042c95aadf9111 Mon Sep 17 00:00:00 2001 From: Per Inge Mathisen Date: Mon, 24 Aug 2009 16:21:29 +0000 Subject: [PATCH] Fix another case of droids driving in circles when pushed off their designated paths and they end up equally close (after applying weights) to both current and next path nodes. git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8049 4a71c877-e1ca-e34f-864e-861f7616d084 --- src/move.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/move.c b/src/move.c index 84b3de2d6..888291b3a 100644 --- a/src/move.c +++ b/src/move.c @@ -1667,8 +1667,10 @@ static Vector2f moveGetDirection(DROID *psDroid) { dest = Vector2f_Normalise(nextDelta); } - // We are passing the next waypoint, so for now don't interpolate it - else if (nextMagnitude < FLT_EPSILON) + // We are passing the next waypoint or so close we could be circling between both, + // so for now don't interpolate it. Instead head to the first unvisited waypoint as + // a silly workaround. What we should do is drop this waypoint and head to the next. + else if (nextMagnitude < WAYPOINT_DSQ) { dest = Vector2f_Normalise(delta); }