Skip to content
Permalink
Browse files

Waypoint skipping fix for Mantis 6206. (#455)

* Waypoint skipping fix.
* invert facePoint condition
  • Loading branch information...
GoogleFrog authored and rtri committed May 8, 2019
1 parent e58208c commit a2d12aa7d26c075c17a92fd4f898ca7c9d5a0c0f
Showing with 4 additions and 2 deletions.
  1. +4 −2 rts/Sim/MoveTypes/GroundMoveType.cpp
@@ -1589,9 +1589,11 @@ bool CGroundMoveType::CanSetNextWayPoint() {
// note: can somehow cause units to move in circles near obstacles
// (mantis3718) if rectangle is too generous in size
const bool rangeTest = owner->moveDef->TestMoveSquareRange(owner, float3::min(cwp, pos), float3::max(cwp, pos), owner->speed, true, true, true);
const bool allowSkip = ((pos - cwp).SqLength() <= Square(SQUARE_SIZE) || (pos - cwp).dot(flatFrontDir) < 0.0f);
const bool facePoint = ((cwp - pos).dot(flatFrontDir) >= 0.0f);
const bool allowSkip = ((cwp - pos).SqLength() <= Square(SQUARE_SIZE));

if (!rangeTest && !allowSkip)
// CanSetNextWayPoint may return true if (allowSkip || (rangeTest && facePoint))
if (!allowSkip && (!rangeTest || !facePoint))
return false;
}

0 comments on commit a2d12aa

Please sign in to comment.
You can’t perform that action at this time.