From 2ef1623c05c210ce841a2c8ed16fda4d758590a8 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 3 Jun 2026 23:48:43 +0100 Subject: [PATCH] Fix: Train reversing when partially in a depot (#15662) --- 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 295d7bc216..da6bd43e05 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1653,7 +1653,10 @@ static void UpdateStatusAfterSwap(Train *v, bool reverse = true) /* Call the proper EnterTile function unless we are in a wormhole. */ if (v->track != TRACK_BIT_WORMHOLE) { - VehicleEnterTile(v, v->tile, v->x_pos, v->y_pos); + /* Do not call EnterTile for vehicles partially or totally in a depot. */ + if (!IsRailDepotTile(v->tile)) { + VehicleEnterTile(v, v->tile, v->x_pos, v->y_pos); + } } else { /* VehicleEnterTile_TunnelBridge() sets TRACK_BIT_WORMHOLE when the vehicle * is on the last bit of the bridge head (frame == TILE_SIZE - 1).