From a6190c9deb2dc817f8cbf97cb16bbd6a2a371a21 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 15 Feb 2022 22:56:21 +0000 Subject: [PATCH] Fix crash in scheduled dispatch window with nearest depot dispatch order --- src/schdispatch_gui.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/schdispatch_gui.cpp b/src/schdispatch_gui.cpp index 4054c5cf19..98addf0b09 100644 --- a/src/schdispatch_gui.cpp +++ b/src/schdispatch_gui.cpp @@ -519,9 +519,17 @@ struct SchdispatchWindow : GeneralVehicleWindow { break; case OT_GOTO_DEPOT: - SetDParam(1, STR_DEPOT_NAME); - SetDParam(2, v->type); - SetDParam(3, order->GetDestination()); + if (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) { + if (v->type == VEH_AIRCRAFT) { + SetDParam(1, STR_ORDER_GO_TO_NEAREST_HANGAR); + } else { + SetDParam(1, STR_ORDER_GO_TO_NEAREST_DEPOT); + } + } else { + SetDParam(1, STR_DEPOT_NAME); + SetDParam(2, v->type); + SetDParam(3, order->GetDestination()); + } break; default: