From 036b73a4e119b68a7b98ea17120b0ccd2bc8f351 Mon Sep 17 00:00:00 2001 From: Bernard Teo Date: Fri, 2 Apr 2021 03:14:24 +0800 Subject: [PATCH] Fix #8922: Show vehicle window for single vehicle in shared order grouping --- src/group_gui.cpp | 7 ++++++- src/vehicle_gui.cpp | 11 +++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 670ee62bc2..5f39066aba 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -894,7 +894,12 @@ public: /* We do not support VehicleClicked() here since the contextual action may only make sense for individual vehicles */ if (vindex == v->index) { - ShowVehicleListWindow(v); + if (vehgroup.NumVehicles() == 1) { + ShowVehicleViewWindow(v); + } + else { + ShowVehicleListWindow(v); + } } break; } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 8ca2f7214f..35d8b3fc10 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1833,12 +1833,19 @@ public: break; } - case GB_SHARED_ORDERS: + case GB_SHARED_ORDERS: { assert(vehgroup.NumVehicles() > 0); + const Vehicle *v = vehgroup.vehicles_begin[0]; /* We do not support VehicleClicked() here since the contextual action may only make sense for individual vehicles */ - ShowVehicleListWindow(vehgroup.vehicles_begin[0]); + if (vehgroup.NumVehicles() == 1) { + ShowVehicleViewWindow(v); + } + else { + ShowVehicleListWindow(v); + } break; + } default: NOT_REACHED(); }