summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vehicle_gui.cpp38
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)