Fix #12203: When unbunching at a depot, don't overlook implicit orders (#12220)

This commit is contained in:
Tyler Trahan 2024-03-08 10:19:50 -05:00 committed by GitHub
parent 0c432bdc4d
commit 5806c2aba4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -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;