diff options
author | rubidium <rubidium@openttd.org> | 2008-04-19 13:07:37 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-04-19 13:07:37 +0000 |
commit | 99733b2b3e98728368ef1c5685c4ddbe6b59daf4 (patch) | |
tree | d735a0831f45a2b4b36b08ac4bce5b7294b06114 /src | |
parent | 081f62701882a4e97b5dff37f51a89965fe9faa5 (diff) | |
download | openttd-99733b2b3e98728368ef1c5685c4ddbe6b59daf4.tar.xz |
(svn r12788) -Codechange: unduplicate some vehicle GUI code. Patch by Alberth.
Diffstat (limited to 'src')
-rw-r--r-- | src/vehicle_gui.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 41c5c840f..092020989 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -35,7 +35,6 @@ #include "settings_type.h" #include "widgets/dropdown_func.h" #include "order_func.h" -#include "depot_base.h" #include "table/sprites.h" #include "table/strings.h" @@ -103,7 +102,11 @@ const StringID _vehicle_sort_listing[] = { INVALID_STRING_ID }; -void RebuildVehicleLists() +/** + * Set sort list flag for all vehicle list windows + * @param sl_flag Sort list flag to set + */ +static void SetVehicleListsFlag(SortListFlags sl_flag) { Window* const *wz; @@ -115,7 +118,7 @@ void RebuildVehicleLists() case WC_ROADVEH_LIST: case WC_SHIPS_LIST: case WC_AIRCRAFT_LIST: - WP(w, vehiclelist_d).l.flags |= VL_REBUILD; + WP(w, vehiclelist_d).l.flags |= sl_flag; SetWindowDirty(w); break; @@ -124,25 +127,20 @@ void RebuildVehicleLists() } } -void ResortVehicleLists() +/** + * Rebuild all vehicle list windows + */ +void RebuildVehicleLists() { - Window* const *wz; - - FOR_ALL_WINDOWS(wz) { - Window *w = *wz; - - switch (w->window_class) { - case WC_TRAINS_LIST: - case WC_ROADVEH_LIST: - case WC_SHIPS_LIST: - case WC_AIRCRAFT_LIST: - WP(w, vehiclelist_d).l.flags |= VL_RESORT; - SetWindowDirty(w); - break; + SetVehicleListsFlag(VL_REBUILD); +} - default: break; - } - } +/** + * Resort all vehicle list windows + */ +void ResortVehicleLists() +{ + SetVehicleListsFlag(VL_RESORT); } void BuildVehicleList(vehiclelist_d *vl, PlayerID owner, uint16 index, uint16 window_type) |