summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--depot_gui.c3
-rw-r--r--vehicle_gui.c5
2 files changed, 8 insertions, 0 deletions
diff --git a/depot_gui.c b/depot_gui.c
index bf3472509..f7b4b9307 100644
--- a/depot_gui.c
+++ b/depot_gui.c
@@ -614,6 +614,8 @@ static void ResizeDepotButtons(Window *w)
}
}
+void DepotSortList(Vehicle **v, uint16 length);
+
static void DepotWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
@@ -637,6 +639,7 @@ static void DepotWndProc(Window *w, WindowEvent *e)
&WP(w, depot_d).vehicle_list, &WP(w, depot_d).engine_list_length, &WP(w, depot_d).engine_count,
&WP(w, depot_d).wagon_list, &WP(w, depot_d).wagon_list_length, &WP(w, depot_d).wagon_count);
WP(w, depot_d).generate_list = false;
+ DepotSortList(WP(w, depot_d).vehicle_list, WP(w, depot_d).engine_count);
#ifndef NDEBUG
} else {
/* Here we got a piece of code, that only checks if we got a different number of vehicles in the depot list and the number of vehicles actually being in the depot.
diff --git a/vehicle_gui.c b/vehicle_gui.c
index d7d1992c8..e2d6eb2ad 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -158,6 +158,11 @@ static void SortVehicleList(vehiclelist_d *vl)
vl->l.flags &= ~VL_RESORT;
}
+void DepotSortList(Vehicle **v, uint16 length)
+{
+ _internal_sort_order = 0;
+ qsort((void*)v, length, sizeof(v[0]), _vehicle_sorter[0]);
+}
/* General Vehicle GUI based procedures that are independent of vehicle types */
void InitializeVehiclesGuiList(void)