Don't use implicit orders for conditional order waiting loops

Fixes vehicles never leaving when the only order is an implicit order
(because vehicles were released with no orders)
This commit is contained in:
Jonathan G Rennison
2022-07-26 20:35:12 +01:00
parent 70ef4c6d90
commit c6817fab6e

View File

@@ -3519,6 +3519,9 @@ static bool ShouldVehicleContinueWaiting(Vehicle *v)
/* Rate-limit re-checking of conditional order loop */
if (HasBit(v->vehicle_flags, VF_COND_ORDER_WAIT) && v->tick_counter % 32 != 0) return true;
/* Don't use implicit orders for waiting loops */
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;
FlushAdvanceOrderIndexDeferred(v, loop);