(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.)

This commit is contained in:
frosch 2011-04-16 17:02:28 +00:00
parent 709f0e4f83
commit 181fd5e3ab

View File

@ -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();