Do not attach temporary wagons to free wagon chains when autoreplacing

See: https://github.com/OpenTTD/OpenTTD/issues/9264
This commit is contained in:
Jonathan G Rennison
2021-05-15 22:32:50 +01:00
parent f3e0507c54
commit 8eb34b2f10

View File

@@ -1929,7 +1929,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 check_on_failure(CMD_ERROR);