From 5806c2aba4601e5880738184f09ac68a0f5ff6aa Mon Sep 17 00:00:00 2001 From: Tyler Trahan Date: Fri, 8 Mar 2024 10:19:50 -0500 Subject: [PATCH] Fix #12203: When unbunching at a depot, don't overlook implicit orders (#12220) --- src/vehicle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 24daa84e96..9ca49be6ad 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -2445,8 +2445,8 @@ bool Vehicle::HasUnbunchingOrder() const static bool PreviousOrderIsUnbunching(const Vehicle *v) { /* If we are headed for the first order, we must wrap around back to the last order. */ - bool is_first_order = (v->GetOrder(v->cur_real_order_index) == v->GetFirstOrder()); - Order *previous_order = (is_first_order) ? v->GetLastOrder() : v->GetOrder(v->cur_real_order_index - 1); + bool is_first_order = (v->GetOrder(v->cur_implicit_order_index) == v->GetFirstOrder()); + Order *previous_order = (is_first_order) ? v->GetLastOrder() : v->GetOrder(v->cur_implicit_order_index - 1); if (previous_order == nullptr || !previous_order->IsType(OT_GOTO_DEPOT)) return false; return (previous_order->GetDepotActionType() & ODATFB_UNBUNCH) != 0;