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 rt committed May 8, 2019
1 parent 4a32dcf commit 1bbd8cdcb5a0a3a68ae6ec0543f9ee26f80c9abc
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 1bbd8cd

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