summaryrefslogtreecommitdiff
path: root/src/order_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-04-16 17:02:28 +0000
committerfrosch <frosch@openttd.org>2011-04-16 17:02:28 +0000
commit181fd5e3ab4cf83514f3859bffa4b97f14398c74 (patch)
tree939be28bbaddecc63a8ae9fa2528768d88926870 /src/order_cmd.cpp
parent709f0e4f8390bffce0a1a26c86c91e0e8cd9fa07 (diff)
downloadopenttd-181fd5e3ab4cf83514f3859bffa4b97f14398c74.tar.xz
(svn r22330) -Change: When a conditional order triggers and causes skipping to a particular order, disable modifications to automatic orders. till reaching the next real order, as we do not know whether to change the targets of conditional orders when inserting automatic orders. (So, when the vehicle skips to an order and later inserts an automatic order, the conditional order will still point to the same order, so the automatic order will be inserted again the next time.)
Diffstat (limited to 'src/order_cmd.cpp')
-rw-r--r--src/order_cmd.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 66b5bf25d..0cbb10b78 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -1865,6 +1865,13 @@ bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth)
v->cur_auto_order_index = v->cur_real_order_index = next_order;
v->UpdateRealOrderIndex();
v->current_order_time += v->GetOrder(v->cur_real_order_index)->travel_time;
+
+ /* Disable creation of automatic orders.
+ * When inserting them we do not know that we would have to make the conditional orders point to them. */
+ if (v->IsGroundVehicle()) {
+ uint16 &gv_flags = v->GetGroundVehicleFlags();
+ SetBit(gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS);
+ }
} else {
UpdateVehicleTimetable(v, true);
v->IncrementRealOrderIndex();