From 181fd5e3ab4cf83514f3859bffa4b97f14398c74 Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 16 Apr 2011 17:02:28 +0000 Subject: [PATCH] (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.) --- src/order_cmd.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index 66b5bf25d5..0cbb10b78e 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();