Don't first increment start order index in AdvanceOrderIndexDeferred

Fixes behaviour of CheckRestartLoadingAtRoadStop
tmp-jgrpp
Jonathan G Rennison 1 month 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)
{
int depth = 0;
++index;
do {
/* 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 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);
if (loop) SetBit(v->vehicle_flags, VF_COND_ORDER_WAIT);
return loop;

Loading…
Cancel
Save