From 0f697c5501357f585ade006f3d96d081c0a6daf3 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 30 Oct 2022 14:11:03 +0000 Subject: [PATCH] CheckNextTrainTile should never take action for OT_WAITING orders --- src/train_cmd.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 36f394bc11..8e1f9ab988 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -3031,7 +3031,7 @@ void ReverseTrainDirection(Train *v) if (IsRailStationTile(v->tile)) SetRailStationPlatformReservation(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), true); if (TryPathReserve(v, false, first_tile_okay)) { /* 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) { /* Do not wait for a way out when we're still loading */ MarkTrainAsStuck(v); @@ -3227,6 +3227,9 @@ static void CheckNextTrainTile(Train *v) /* Exit if we are inside a depot. */ 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. */ if (HasStationTileRail(v->tile) && v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile), IsRailWaypoint(v->tile))) return;