Mercurial > hg > openttd
changeset 8993:1b2c82dc4d69 draft
(svn r12788) -Codechange: unduplicate some vehicle GUI code. Patch by Alberth.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sat, 19 Apr 2008 13:07:37 +0000 |
parents | c0e03990caf0 |
children | e4c3087abbde |
files | src/vehicle_gui.cpp |
diffstat | 1 files changed, 18 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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 @@ 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 @@ } } +/** + * Rebuild all vehicle list windows + */ +void RebuildVehicleLists() +{ + SetVehicleListsFlag(VL_REBUILD); +} + +/** + * Resort all vehicle list windows + */ void ResortVehicleLists() { - 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; - - default: break; - } - } + SetVehicleListsFlag(VL_RESORT); } void BuildVehicleList(vehiclelist_d *vl, PlayerID owner, uint16 index, uint16 window_type)