From c6817fab6ef6f4b551e4ca339e41ad120544496d Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 26 Jul 2022 20:35:12 +0100 Subject: [PATCH] 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) --- src/vehicle.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 270cf02609..48a0e585e0 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -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);