summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2007-01-11 15:30:35 +0000
committercelestar <celestar@openttd.org>2007-01-11 15:30:35 +0000
commit5675956443d4e58713a0abd8cedb4eaaaccf22d4 (patch)
treee0e327337a5616cef357fa28d4e912f83eb6e6ab
parent1670fec5256dad9f56d718403aa527e45f37467b (diff)
downloadopenttd-5675956443d4e58713a0abd8cedb4eaaaccf22d4.tar.xz
(svn r8065) -Feature: The station list does now remember the sort settings
-rw-r--r--src/station_gui.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 56b05ee0e..c4f778e1a 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -266,6 +266,8 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
const PlayerID owner = (PlayerID)w->window_number;
static byte facilities = FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK;
static uint16 cargo_filter = CARGO_ALL_SELECTED;
+ static Listing station_sort = {0, 0};
+
plstations_d *sl = &WP(w, plstations_d);
switch (e->event) {
@@ -283,7 +285,8 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
sl->sort_list = NULL;
sl->flags = SL_REBUILD;
- sl->sort_type = 0;
+ sl->sort_type = station_sort.criteria;
+ if (station_sort.order) sl->flags |= SL_ORDER;
sl->resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS;
break;
}
@@ -436,6 +439,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
}
case STATIONLIST_WIDGET_SORTBY: /*flip sorting method asc/desc*/
sl->flags ^= SL_ORDER; //DESC-flag
+ station_sort.order = GB(sl->flags, 0, 1);
sl->flags |= SL_RESORT;
w->flags4 |= 5 << WF_TIMEOUT_SHL;
LowerWindowWidget(w, STATIONLIST_WIDGET_SORTBY);
@@ -471,6 +475,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
if (sl->sort_type != e->we.dropdown.index) {
// value has changed -> resort
sl->sort_type = e->we.dropdown.index;
+ station_sort.criteria = sl->sort_type;
sl->flags |= SL_RESORT;
}
SetWindowDirty(w);