Skip to content

Commit

Permalink
Have QTPFS report nopoint when out of waypoints. Allows units to stop…
Browse files Browse the repository at this point in the history
… when goal isn't reachable.
  • Loading branch information
marcushutchings committed Aug 1, 2023
1 parent 945a8ee commit de904f0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rts/Sim/Path/QTPFS/PathManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1260,8 +1260,8 @@ float3 QTPFS::PathManager::NextWayPoint(

if (!IsFinalized())
return noPathPoint;
if (!synced)
return noPathPoint;
// if (!synced)
// return noPathPoint;

// dangling ID after a re-request failure or regular deletion
// return an error-vector so GMT knows it should stop the unit
Expand Down Expand Up @@ -1312,6 +1312,9 @@ float3 QTPFS::PathManager::NextWayPoint(
unsigned int minPointIdx = livePath->GetNextPointIndex();
unsigned int nxtPointIdx = 1;

if (minPointIdx == livePath->NumPoints() - 1)
return noPathPoint;

for (unsigned int i = (livePath->GetNextPointIndex()); i < (livePath->NumPoints() - 1); i++) {
const float radiusSq = (point - livePath->GetPoint(i)).SqLength2D();

Expand Down

0 comments on commit de904f0

Please sign in to comment.