From 3384638e36da8707e2907dabe2eebf04d267253a Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 12 Sep 2008 21:58:36 +0000 Subject: (svn r14302) -Codechange: simplify and make the vehicle list and group windows behave the same w.r.t. getting wider (by default) for trains than the other vehicles. --- src/group_gui.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src/group_gui.cpp') diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 3b5d7f1af..adda77ba6 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -256,6 +256,7 @@ public: } this->FindWindowPlacementAndResize(desc); + if (this->vehicle_type == VEH_TRAIN) ResizeWindow(this, 65, 0); } ~VehicleGroupWindow() @@ -723,9 +724,9 @@ public: }; -static const WindowDesc _group_desc = { - WDP_AUTO, WDP_AUTO, 460, 194, 526, 246, - WC_TRAINS_LIST, WC_NONE, +static WindowDesc _group_desc = { + WDP_AUTO, WDP_AUTO, 460, 194, 460, 246, + WC_INVALID, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _group_widgets, }; @@ -734,18 +735,7 @@ void ShowPlayerGroup(PlayerID player, VehicleType vehicle_type) { if (!IsValidPlayerID(player)) return; - WindowClass wc; - - switch (vehicle_type) { - default: NOT_REACHED(); - case VEH_TRAIN: wc = WC_TRAINS_LIST; break; - case VEH_ROAD: wc = WC_ROADVEH_LIST; break; - case VEH_SHIP: wc = WC_SHIPS_LIST; break; - case VEH_AIRCRAFT: wc = WC_AIRCRAFT_LIST; break; - } - + _group_desc.cls = GetWindowClassForVehicleType(vehicle_type); WindowNumber num = (vehicle_type << 11) | VLW_GROUP_LIST | player; - DeleteWindowById(wc, num); - Window *w = new VehicleGroupWindow(&_group_desc, num); - w->window_class = wc; + AllocateWindowDescFront(&_group_desc, num); } -- cgit v1.2.3-54-g00ecf