forked from mirror/OpenTTD
(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)
This commit is contained in:
@@ -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 */
|
||||
|
Reference in New Issue
Block a user