summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-11-10 22:56:43 +0000
committerrubidium <rubidium@openttd.org>2007-11-10 22:56:43 +0000
commit3a8cdc37ce0bcf1f5c735d53dc5dbd613a11701a (patch)
treec632667aed94af1aaad7bd1abdcd6e8a25ed6fd4 /src/vehicle.cpp
parentf55fdfb7c42b2e2e39b165fd17f7671e14516303 (diff)
downloadopenttd-3a8cdc37ce0bcf1f5c735d53dc5dbd613a11701a.tar.xz
(svn r11400) -Fix [FS#1409]: assign orders during cloning after refitting as it needs the cargo types to be the same.
Diffstat (limited to 'src/vehicle.cpp')
-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)) {