summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-07-09 18:45:35 +0000
committerfrosch <frosch@openttd.org>2012-07-09 18:45:35 +0000
commit0ead281439ab408744a6099322bf98fcec86d539 (patch)
tree2a42cf141734fbaecda6a05ee38e64917d4ce33f /src
parent6aa2b757aa6af36c1ac2e5c2efe7948fe2d98c9b (diff)
downloadopenttd-0ead281439ab408744a6099322bf98fcec86d539.tar.xz
(svn r24390) -Change [FS#5213]: Allow cloning of orders which are unreachable for the destination vehicle if they were already unreachable for the source vehicle. This makes cloning/autorenewing/autoreplacing behave more smooth during station reconstruction.
Diffstat (limited to 'src')
-rw-r--r--src/order_cmd.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index d79f1e804..1f8066086 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -1472,8 +1472,13 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
const Order *order;
FOR_VEHICLE_ORDERS(src, order) {
- if (OrderGoesToStation(dst, order) &&
- !CanVehicleUseStation(dst, Station::Get(order->GetDestination()))) {
+ if (!OrderGoesToStation(dst, order)) continue;
+
+ /* Allow copying unreachable destinations if they were already unreachable for the source.
+ * This is basically to allow cloning / autorenewing / autoreplacing vehicles, while the stations
+ * are temporarily invalid due to reconstruction. */
+ const Station *st = Station::Get(order->GetDestination());
+ if (CanVehicleUseStation(src, st) && !CanVehicleUseStation(dst, st)) {
return_cmd_error(STR_ERROR_CAN_T_COPY_SHARE_ORDER);
}
}