This commit is contained in:
@@ -2249,22 +2249,22 @@ void Vehicle::BeginLoading()
|
|||||||
InvalidateVehicleOrder(this, 0);
|
InvalidateVehicleOrder(this, 0);
|
||||||
} else {
|
} else {
|
||||||
/* Delete all implicit orders up to the station we just reached */
|
/* Delete all implicit orders up to the station we just reached */
|
||||||
VehicleOrderID cur = this->cur_implicit_order_index;
|
const Order *order = this->GetOrder(this->cur_implicit_order_index);
|
||||||
auto orders = this->Orders();
|
while (!order->IsType(OT_IMPLICIT) || order->GetDestination() != this->last_station_visited) {
|
||||||
while (!orders[cur].IsType(OT_IMPLICIT) || orders[cur].GetDestination() != this->last_station_visited) {
|
if (order->IsType(OT_IMPLICIT)) {
|
||||||
if (orders[cur].IsType(OT_IMPLICIT)) {
|
|
||||||
DeleteOrder(this, this->cur_implicit_order_index);
|
DeleteOrder(this, this->cur_implicit_order_index);
|
||||||
/* DeleteOrder does various magic with order_indices, so resync 'order' with 'cur_implicit_order_index' */
|
|
||||||
} else {
|
} else {
|
||||||
/* Skip non-implicit orders, e.g. service-orders */
|
/* Skip non-implicit orders, e.g. service-orders */
|
||||||
if (cur < this->orders->GetNext(cur)) {
|
++this->cur_implicit_order_index;
|
||||||
this->cur_implicit_order_index++;
|
}
|
||||||
} else {
|
order = this->GetOrder(this->cur_implicit_order_index);
|
||||||
|
|
||||||
/* Wrapped around. */
|
/* Wrapped around. */
|
||||||
|
if (order == nullptr) {
|
||||||
this->cur_implicit_order_index = 0;
|
this->cur_implicit_order_index = 0;
|
||||||
|
order = this->GetOrder(this->cur_implicit_order_index);
|
||||||
}
|
}
|
||||||
cur = this->orders->GetNext(cur);
|
assert(order != nullptr);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!suppress_implicit_orders &&
|
} else if (!suppress_implicit_orders &&
|
||||||
|
|||||||
Reference in New Issue
Block a user