summaryrefslogtreecommitdiff
path: root/roadveh_gui.c
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2005-01-31 11:03:23 +0000
committerdarkvater <darkvater@openttd.org>2005-01-31 11:03:23 +0000
commit0e272f2d1006206baa7820cbbf04e3617feabb9d (patch)
tree6cfb4e4ff6887ed491747fa9b1aa2d19063aab51 /roadveh_gui.c
parentbb680056b1004ca5e8e74786764061aeedf9c188 (diff)
downloadopenttd-0e272f2d1006206baa7820cbbf04e3617feabb9d.tar.xz
(svn r1750) - Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type (bociusz)
Diffstat (limited to 'roadveh_gui.c')
-rw-r--r--roadveh_gui.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/roadveh_gui.c b/roadveh_gui.c
index 7286803d4..009b8b6a4 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -808,8 +808,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
/* draw sorting criteria string */
DrawString(85, 15, _vehicle_sort_listing[vl->sort_type], 0x10);
/* draw arrow pointing up/down for ascending/descending sorting */
- DoDrawString(
- vl->flags & VL_DESC ? "\xAA" : "\xA0", 69, 15, 0x10);
+ DoDrawString(vl->flags & VL_DESC ? "\xAA" : "\xA0", 69, 15, 0x10);
max = min(w->vscroll.pos + w->vscroll.cap, vl->list_length);
for (i = w->vscroll.pos; i < max; ++i) {
@@ -846,6 +845,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
case 3: /* Flip sorting method ascending/descending */
vl->flags ^= VL_DESC;
vl->flags |= VL_RESORT;
+ _sorting.roadveh.order = !!(vl->flags & VL_DESC);
SetWindowDirty(w);
break;
@@ -906,18 +906,19 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
// value has changed -> resort
vl->flags |= VL_RESORT;
vl->sort_type = e->dropdown.index;
+ _sorting.roadveh.criteria = vl->sort_type;
// enable 'Sort By' if a sorter criteria is chosen
if (vl->sort_type != SORT_BY_UNSORTED)
- w->disabled_state &= ~(1 << 3);
+ CLRBIT(w->disabled_state, 3);
}
SetWindowDirty(w);
break;
case WE_CREATE: /* set up resort timer */
vl->sort_list = NULL;
- vl->flags = VL_REBUILD;
- vl->sort_type = SORT_BY_UNSORTED;
+ vl->flags = VL_REBUILD | (_sorting.roadveh.order << (VL_DESC - 1));
+ vl->sort_type = _sorting.roadveh.criteria;
vl->resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS;
break;
@@ -935,7 +936,6 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
}
break;
-
case WE_RESIZE:
/* Update the scroll + matrix */
w->vscroll.cap += e->sizing.diff.y / PLY_WND_PRC__SIZE_OF_ROW_SMALL;