From 6d99162df9c68562893a3755664ca092c77899d5 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Mon, 6 Feb 2017 18:45:14 +0000 Subject: [PATCH] Fix disable mask for sorter drop-down being mis-aligned. Sort by length was incorrectly available, and crashed for non ground vehicles. --- src/group_gui.cpp | 3 ++- src/vehicle_gui.cpp | 2 +- src/vehicle_gui_base.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 81fb1202e4..66c4f8a634 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -586,7 +586,8 @@ public: break; case WID_GL_SORT_BY_DROPDOWN: // Select sorting criteria dropdown menu - ShowDropDownMenu(this, this->vehicle_sorter_names, this->vehicles.SortType(), WID_GL_SORT_BY_DROPDOWN, 0, (this->vli.vtype == VEH_TRAIN || this->vli.vtype == VEH_ROAD) ? 0 : (1 << 10)); + ShowDropDownMenu(this, this->vehicle_sorter_names, this->vehicles.SortType(), WID_GL_SORT_BY_DROPDOWN, 0, + (this->vli.vtype == VEH_TRAIN || this->vli.vtype == VEH_ROAD) ? 0 : this->vehicle_sorter_non_ground_veh_disable_mask); return; case WID_GL_ALL_VEHICLES: // All vehicles button diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 9b163899ef..a0c909da3d 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1631,7 +1631,7 @@ public: case WID_VL_SORT_BY_PULLDOWN:// Select sorting criteria dropdown menu ShowDropDownMenu(this, this->vehicle_sorter_names, this->vehicles.SortType(), WID_VL_SORT_BY_PULLDOWN, 0, - (this->vli.vtype == VEH_TRAIN || this->vli.vtype == VEH_ROAD) ? 0 : (1 << 10)); + (this->vli.vtype == VEH_TRAIN || this->vli.vtype == VEH_ROAD) ? 0 : this->vehicle_sorter_non_ground_veh_disable_mask); return; case WID_VL_LIST: { // Matrix to show vehicles diff --git a/src/vehicle_gui_base.h b/src/vehicle_gui_base.h index 1c03f7b34d..692de3d89a 100644 --- a/src/vehicle_gui_base.h +++ b/src/vehicle_gui_base.h @@ -37,6 +37,7 @@ struct BaseVehicleListWindow : public Window { static const StringID vehicle_depot_name[]; static const StringID vehicle_sorter_names[]; static GUIVehicleList::SortFunction * const vehicle_sorter_funcs[]; + const uint vehicle_sorter_non_ground_veh_disable_mask = (1 << 11); // STR_SORT_BY_LENGTH BaseVehicleListWindow(WindowDesc *desc, WindowNumber wno) : Window(desc), vli(wno) {