Fix order index wrapping when depth exceeded in AdvanceOrderIndex

This commit is contained in:
Jonathan G Rennison
2021-02-27 14:57:17 +00:00
parent 18471da6e1
commit 460d504269

View File

@@ -630,6 +630,9 @@ void AdvanceOrderIndex(const Vehicle *v, VehicleOrderID &index)
++index;
depth++;
} while (depth < v->GetNumOrders());
/* Wrap around. */
if (index >= v->GetNumOrders()) index = 0;
}
int PredictStationStoppingLocation(const Train *v, const Order *order, int station_length, DestinationID dest)