summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vehicle.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index d734d229d..eb655b49b 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1769,10 +1769,9 @@ CommandCost CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return result; // return error and the message returned from CMD_MOVE_RAIL_VEHICLE
}
} else {
- /* this is a front engine or not a train. It need orders */
+ /* this is a front engine or not a train. */
w_front = w;
w->service_interval = v->service_interval;
- DoCommand(0, (v->index << 16) | w->index, p2 & 1 ? CO_SHARE : CO_COPY, flags, CMD_CLONE_ORDER);
}
w_rear = w; // trains needs to know the last car in the train, so they can add more in next loop
}
@@ -1836,6 +1835,15 @@ CommandCost CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if ((flags & DC_EXEC) && v->type == VEH_TRAIN) w = GetNextVehicle(w);
} while (v->type == VEH_TRAIN && (v = GetNextVehicle(v)) != NULL);
+ if (flags & DC_EXEC) {
+ /*
+ * Set the orders of the vehicle. Cannot do it earlier as we need
+ * the vehicle refitted before doing this, otherwise the moved
+ * cargo types might not match (passenger vs non-passenger)
+ */
+ DoCommand(0, (v_front->index << 16) | w_front->index, p2 & 1 ? CO_SHARE : CO_COPY, flags, CMD_CLONE_ORDER);
+ }
+
/* Since we can't estimate the cost of cloning a vehicle accurately we must
* check whether the player has enough money manually. */
if (!CheckPlayerHasMoney(total_cost)) {