summaryrefslogtreecommitdiff
path: root/src/order_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-04-16 17:06:59 +0000
committerfrosch <frosch@openttd.org>2011-04-16 17:06:59 +0000
commit8dd2f413bd896983df15f7fe1d5cf019cfb0184e (patch)
treeecc2da367fc4e9fa5f0be121c5e6cde7f90c0798 /src/order_cmd.cpp
parent181fd5e3ab4cf83514f3859bffa4b97f14398c74 (diff)
downloadopenttd-8dd2f413bd896983df15f7fe1d5cf019cfb0184e.tar.xz
(svn r22331) -Change: When inserting an (automatic) order A in front of an order B, disable modifications of automatic orders for all vehicles currently heading for B as we do not know whether they will reach A or B first. (except for the vehicle causing the insertion of the automatic order itself)
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 0cbb10b78..3adaab218 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -830,6 +830,13 @@ void InsertOrder(Vehicle *v, Order *new_o, VehicleOrderID sel_ord)
u->cur_real_order_index = cur;
}
}
+ if (sel_ord == u->cur_auto_order_index && u->IsGroundVehicle()) {
+ /* We are inserting an order just before the current automatic order.
+ * We do not know whether we will reach current automatic or the newly inserted order first.
+ * So, disable creation of automatic orders until we are on track again. */
+ uint16 &gv_flags = u->GetGroundVehicleFlags();
+ SetBit(gv_flags, GVF_SUPPRESS_AUTOMATIC_ORDERS);
+ }
if (sel_ord <= u->cur_auto_order_index) {
uint cur = u->cur_auto_order_index + 1;
/* Check if we don't go out of bound */