summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-03-04 10:02:00 +0000
committerrubidium <rubidium@openttd.org>2009-03-04 10:02:00 +0000
commitf16f7e2c928c96cb90c62905cfadc889aeac083e (patch)
tree681dc235652934f01fce59642ca86c8f45ca3ef0 /src
parenta6ca7b82372f59ff3d591e032b0b2b6a906fa1dc (diff)
downloadopenttd-f16f7e2c928c96cb90c62905cfadc889aeac083e.tar.xz
(svn r15611) -Change: when sorting files on modification date and the modification date is equal sort on the title so reversing the sorting direction actually reverses the order the listed files
Diffstat (limited to 'src')
-rw-r--r--src/fios.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/fios.cpp b/src/fios.cpp
index 8c68a9e62..ab85a8511 100644
--- a/src/fios.cpp
+++ b/src/fios.cpp
@@ -49,14 +49,14 @@ int CDECL compare_FiosItems(const void *a, const void *b)
{
const FiosItem *da = (const FiosItem *)a;
const FiosItem *db = (const FiosItem *)b;
- int r;
+ int r = 0;
- if (_savegame_sort_order & SORT_BY_NAME) {
- r = strcasecmp(da->title, db->title);
- } else {
+ if ((_savegame_sort_order & SORT_BY_NAME) == 0) {
r = da->mtime < db->mtime ? -1 : 1;
}
+ if (r == 0) r = strcasecmp(da->title, db->title);
+
if (_savegame_sort_order & SORT_DESCENDING) r = -r;
return r;
}