From a896753ecc231b31464c71347a2e948a960a3547 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 15 May 2021 22:32:50 +0100 Subject: Fix #9264: Do not attach temporary wagons to free wagon chains when autoreplacing --- src/train_cmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index dc87827a7..3b1667094 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1178,7 +1178,7 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u /* if nothing is selected as destination, try and find a matching vehicle to drag to. */ Train *dst; if (d == INVALID_VEHICLE) { - dst = src->IsEngine() ? nullptr : FindGoodVehiclePos(src); + dst = (src->IsEngine() || (flags & DC_AUTOREPLACE)) ? nullptr : FindGoodVehiclePos(src); } else { dst = Train::GetIfValid(d); if (dst == nullptr) return CMD_ERROR; -- cgit v1.2.3-70-g09d2