CheckNextTrainTile should never take action for OT_WAITING orders

This commit is contained in:
Jonathan G Rennison
2022-10-30 14:11:03 +00:00
parent 6ac311d71e
commit 0f697c5501

View File

@@ -3031,7 +3031,7 @@ void ReverseTrainDirection(Train *v)
if (IsRailStationTile(v->tile)) SetRailStationPlatformReservation(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), true); if (IsRailStationTile(v->tile)) SetRailStationPlatformReservation(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), true);
if (TryPathReserve(v, false, first_tile_okay)) { if (TryPathReserve(v, false, first_tile_okay)) {
/* Do a look-ahead now in case our current tile was already a safe tile. */ /* Do a look-ahead now in case our current tile was already a safe tile. */
if (!v->current_order.IsType(OT_WAITING)) CheckNextTrainTile(v); CheckNextTrainTile(v);
} else if (v->current_order.GetType() != OT_LOADING) { } else if (v->current_order.GetType() != OT_LOADING) {
/* Do not wait for a way out when we're still loading */ /* Do not wait for a way out when we're still loading */
MarkTrainAsStuck(v); MarkTrainAsStuck(v);
@@ -3227,6 +3227,9 @@ static void CheckNextTrainTile(Train *v)
/* Exit if we are inside a depot. */ /* Exit if we are inside a depot. */
if (v->track == TRACK_BIT_DEPOT) return; if (v->track == TRACK_BIT_DEPOT) return;
/* Exit if we are currently in a waiting order */
if (v->current_order.IsType(OT_WAITING)) return;
/* Exit if we are on a station tile and are going to stop. */ /* Exit if we are on a station tile and are going to stop. */
if (HasStationTileRail(v->tile) && v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile), IsRailWaypoint(v->tile))) return; if (HasStationTileRail(v->tile) && v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile), IsRailWaypoint(v->tile))) return;