summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan G Rennison <j.g.rennison@gmail.com>2021-05-15 22:32:50 +0100
committerrubidium42 <rubidium42@users.noreply.github.com>2021-05-23 21:05:55 +0200
commita896753ecc231b31464c71347a2e948a960a3547 (patch)
treea47cb329cabc2c31fe311b836a55fb1ca95c1c2c
parent33d99d27f4426e7d087b7ea3ed8e84d1059e1b76 (diff)
downloadopenttd-a896753ecc231b31464c71347a2e948a960a3547.tar.xz
Fix #9264: Do not attach temporary wagons to free wagon chains when autoreplacing
-rw-r--r--src/train_cmd.cpp2
1 files changed, 1 insertions, 1 deletions
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;