Don't first increment start order index in AdvanceOrderIndexDeferred

Fixes behaviour of CheckRestartLoadingAtRoadStop
pull/684/head
Jonathan G Rennison 2 months ago
parent 4a767b279c
commit 2c63a65b87

@ -3422,7 +3422,6 @@ VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v, Pro
VehicleOrderID AdvanceOrderIndexDeferred(const Vehicle *v, VehicleOrderID index) VehicleOrderID AdvanceOrderIndexDeferred(const Vehicle *v, VehicleOrderID index)
{ {
int depth = 0; int depth = 0;
++index;
do { do {
/* Wrap around. */ /* Wrap around. */

@ -3721,7 +3721,7 @@ static bool ShouldVehicleContinueWaiting(Vehicle *v)
if (v->cur_implicit_order_index < v->GetNumOrders() && v->GetOrder(v->cur_implicit_order_index)->IsType(OT_IMPLICIT)) return false; if (v->cur_implicit_order_index < v->GetNumOrders() && v->GetOrder(v->cur_implicit_order_index)->IsType(OT_IMPLICIT)) return false;
/* If conditional orders lead back to this order, just keep waiting without leaving the order */ /* If conditional orders lead back to this order, just keep waiting without leaving the order */
bool loop = AdvanceOrderIndexDeferred(v, v->cur_implicit_order_index) == v->cur_implicit_order_index; bool loop = AdvanceOrderIndexDeferred(v, v->cur_implicit_order_index + 1) == v->cur_implicit_order_index;
FlushAdvanceOrderIndexDeferred(v, loop); FlushAdvanceOrderIndexDeferred(v, loop);
if (loop) SetBit(v->vehicle_flags, VF_COND_ORDER_WAIT); if (loop) SetBit(v->vehicle_flags, VF_COND_ORDER_WAIT);
return loop; return loop;

Loading…
Cancel
Save