aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/kfile.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2010-06-03 23:37:05 +0000
committerJohannes Schickel2010-06-03 23:37:05 +0000
commit664c86f25d5476089194650fe3d6509c5c4d7c2f (patch)
tree2304a325b69e9ef863cefedee355b58e2c1be81f /engines/sci/engine/kfile.cpp
parent02ed1a684ae54b1ae3124aa3064889164e33ed69 (diff)
downloadscummvm-rg350-664c86f25d5476089194650fe3d6509c5c4d7c2f.tar.gz
scummvm-rg350-664c86f25d5476089194650fe3d6509c5c4d7c2f.tar.bz2
scummvm-rg350-664c86f25d5476089194650fe3d6509c5c4d7c2f.zip
Replace two uses of ::qsort by Common::sort.
svn-id: r49418
Diffstat (limited to 'engines/sci/engine/kfile.cpp')
-rw-r--r--engines/sci/engine/kfile.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index ba8714366f..18b1e02eba 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -245,13 +245,10 @@ static void fgets_wrapper(EngineState *s, char *dest, int maxsize, int handle) {
debugC(2, kDebugLevelFile, "FGets'ed \"%s\"", dest);
}
-static int _savegame_index_struct_compare(const void *a, const void *b) {
- const SavegameDesc *A = (const SavegameDesc *)a;
- const SavegameDesc *B = (const SavegameDesc *)b;
-
- if (B->date != A->date)
- return B->date - A->date;
- return B->time - A->time;
+static bool _savegame_index_struct_compare(const SavegameDesc &l, const SavegameDesc &r) {
+ if (l.date != r.date)
+ return (l.date > r.date);
+ return (l.time > r.time);
}
void listSavegames(Common::Array<SavegameDesc> &saves) {
@@ -285,7 +282,7 @@ void listSavegames(Common::Array<SavegameDesc> &saves) {
}
// Sort the list by creation date of the saves
- qsort(saves.begin(), saves.size(), sizeof(SavegameDesc), _savegame_index_struct_compare);
+ Common::sort(saves.begin(), saves.end(), _savegame_index_struct_compare);
}
bool Console::cmdListSaves(int argc, const char **argv) {