forked from mirror/OpenTTD
(svn r3055) Give the savegame/scenarion sort order flags symbolic names
This commit is contained in:
13
win32.c
13
win32.c
@@ -644,12 +644,13 @@ int CDECL compare_FiosItems(const void *a, const void *b)
|
||||
const FiosItem *db = (const FiosItem *)b;
|
||||
int r;
|
||||
|
||||
if (_savegame_sort_order < 2) // sort by date
|
||||
r = da->mtime < db->mtime ? -1 : 1;
|
||||
else
|
||||
if (_savegame_sort_order & SORT_BY_NAME) {
|
||||
r = strcasecmp(da->title, db->title);
|
||||
} else {
|
||||
r = da->mtime < db->mtime ? -1 : 1;
|
||||
}
|
||||
|
||||
if (_savegame_sort_order & 1) r = -r;
|
||||
if (_savegame_sort_order & SORT_DESCENDING) r = -r;
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -698,7 +699,7 @@ FiosItem *FiosGetSavegameList(int *num, int mode)
|
||||
{
|
||||
/* XXX ugly global variables ... */
|
||||
byte order = _savegame_sort_order;
|
||||
_savegame_sort_order = 2; // sort ascending by name
|
||||
_savegame_sort_order = SORT_BY_NAME | SORT_ASCENDING;
|
||||
qsort(_fios_items, _fios_count, sizeof(FiosItem), compare_FiosItems);
|
||||
_savegame_sort_order = order;
|
||||
}
|
||||
@@ -812,7 +813,7 @@ FiosItem *FiosGetScenarioList(int *num, int mode)
|
||||
{
|
||||
/* XXX ugly global variables ... */
|
||||
byte order = _savegame_sort_order;
|
||||
_savegame_sort_order = 2; // sort ascending by name
|
||||
_savegame_sort_order = SORT_BY_NAME | SORT_ASCENDING;
|
||||
qsort(_fios_items, _fios_count, sizeof(FiosItem), compare_FiosItems);
|
||||
_savegame_sort_order = order;
|
||||
}
|
||||
|
Reference in New Issue
Block a user