summaryrefslogtreecommitdiff
path: root/town_gui.c
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-09-06 18:15:13 +0000
committerdarkvater <darkvater@openttd.org>2004-09-06 18:15:13 +0000
commitbf0652d3fce57024fe56f75d43898a261fea7570 (patch)
treeff59ad94248c5c270741fe954c139e1f953b197c /town_gui.c
parentdf1397a47e68cf07d0a0d4fe02758f4b4f8c469f (diff)
downloadopenttd-bf0652d3fce57024fe56f75d43898a261fea7570.tar.xz
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
-Fix: Sorter icon pointing down 'v' sorts in every window lowest value first, '^' highest value first -CodeChange: move Dropdownlist from settings_gui.c to widget.c. More in place there.
Diffstat (limited to 'town_gui.c')
-rw-r--r--town_gui.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/town_gui.c b/town_gui.c
index 3a8bf8726..8d6cfbd5d 100644
--- a/town_gui.c
+++ b/town_gui.c
@@ -351,7 +351,7 @@ static uint _num_town_sort;
static char _bufcache[64];
static byte _last_town_idx;
-static int CDECL TownSorterByName(const void *a, const void *b)
+static int CDECL TownNameSorter(const void *a, const void *b)
{
char buf1[64];
Town *t;
@@ -374,11 +374,11 @@ static int CDECL TownSorterByName(const void *a, const void *b)
return r;
}
-static int CDECL TownSorterByPop(const void *a, const void *b)
+static int CDECL TownPopSorter(const void *a, const void *b)
{
Town *ta = DEREF_TOWN(*(byte*)a);
Town *tb = DEREF_TOWN(*(byte*)b);
- int r = tb->population - ta->population;
+ int r = ta->population - tb->population;
if (_town_sort_order & 1) r = -r;
return r;
}
@@ -391,7 +391,7 @@ static void MakeSortedTownList()
_num_town_sort = n;
_last_town_idx = 255; // used for "cache"
- qsort(_town_sort, n, 1, _town_sort_order & 2 ? TownSorterByPop : TownSorterByName);
+ qsort(_town_sort, n, sizeof(_town_sort[0]), _town_sort_order & 2 ? TownPopSorter : TownNameSorter);
DEBUG(misc, 1) ("Resorting Towns list...");
}