Skip to content

Commit

Permalink
Avoid incomplete paths are failing too soon. Fixes #1217
Browse files Browse the repository at this point in the history
  • Loading branch information
marcushutchings committed Jan 18, 2024
1 parent 21afcff commit ff7ac35
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions rts/Sim/MoveTypes/GroundMoveType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2192,6 +2192,17 @@ bool CGroundMoveType::CanSetNextWayPoint(int thread) {
//
// atEndOfPath |= (currWayPoint == nextWayPoint);
atEndOfPath |= (curGoalDistSq <= minGoalDistSq);

if (!atEndOfPath) {
lastWaypoint |= (earlyCurrWayPoint.same(earlyNextWayPoint)
&& pathManager->CurrentWaypointIsUnreachable(pathID)
&& (cwpDistSq <= minGoalDistSq));
if (lastWaypoint) {
// incomplete path and last valid waypoint has been reached.
pathingFailed = true;
return false;
}
}
}

if (atEndOfPath) {
Expand Down Expand Up @@ -2232,13 +2243,6 @@ void CGroundMoveType::SetNextWayPoint(int thread)

// Prevent delay repaths because the waypoints have been updated.
wantRepath = false;

lastWaypoint |= (earlyCurrWayPoint.same(earlyNextWayPoint) && pathManager->CurrentWaypointIsUnreachable(pathID));
if (lastWaypoint) {
// incomplete path and last valid waypoint has been reached.
// ReRequestPath(false);
pathingFailed = true;
}
}

if (earlyNextWayPoint.x == -1.0f && earlyNextWayPoint.z == -1.0f) {
Expand Down

0 comments on commit ff7ac35

Please sign in to comment.