diff options
author | Gregory Montoir | 2008-11-30 12:23:24 +0000 |
---|---|---|
committer | Gregory Montoir | 2008-11-30 12:23:24 +0000 |
commit | 8d59712192fad46b95fd2dc36d659b2c2649c873 (patch) | |
tree | a4b867e0da8d140a672587419398f16f1a0c0488 /engines | |
parent | 2730a6dddce10c1ff387a64355822707fc93c8ae (diff) | |
download | scummvm-rg350-8d59712192fad46b95fd2dc36d659b2c2649c873.tar.gz scummvm-rg350-8d59712192fad46b95fd2dc36d659b2c2649c873.tar.bz2 scummvm-rg350-8d59712192fad46b95fd2dc36d659b2c2649c873.zip |
fixed listSaves ordering
svn-id: r35191
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tucker/detection.cpp | 18 | ||||
-rw-r--r-- | engines/tucker/tucker.h | 3 |
2 files changed, 14 insertions, 7 deletions
diff --git a/engines/tucker/detection.cpp b/engines/tucker/detection.cpp index 8263b6eb91..cfbac613f5 100644 --- a/engines/tucker/detection.cpp +++ b/engines/tucker/detection.cpp @@ -125,26 +125,32 @@ public: virtual SaveStateList listSaves(const char *target) const { Common::String pattern = Tucker::generateGameStateFileName(target, 0, true); Common::StringList filenames = g_system->getSavefileManager()->listSavefiles(pattern.c_str()); - sort(filenames.begin(), filenames.end()); + bool slotsTable[Tucker::kLastSaveSlot + 1]; + memset(slotsTable, 0, sizeof(slotsTable)); SaveStateList saveList; for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { int slot; const char *ext = strrchr(file->c_str(), '.'); - if (ext && (slot = atoi(ext + 1)) >= 0) { + if (ext && (slot = atoi(ext + 1)) >= 0 && slot <= Tucker::kLastSaveSlot) { Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(file->c_str()); if (in) { - char description[64]; - snprintf(description, sizeof(description), "savegm.%02d", slot); - saveList.push_back(SaveStateDescriptor(slot, description)); + slotsTable[slot] = true; delete in; } } } + for (int slot = 0; slot <= Tucker::kLastSaveSlot; ++slot) { + if (slotsTable[slot]) { + char description[64]; + snprintf(description, sizeof(description), "savegm.%02d", slot); + saveList.push_back(SaveStateDescriptor(slot, description)); + } + } return saveList; } virtual int getMaximumSaveSlot() const { - return 99; + return Tucker::kLastSaveSlot; } virtual void removeSaveState(const char *target, int slot) const { diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h index b26e8b20b4..5d9ad6b007 100644 --- a/engines/tucker/tucker.h +++ b/engines/tucker/tucker.h @@ -176,7 +176,8 @@ enum { kFadePaletteStep = 5, kStartupLocation = 1, kDefaultCharSpeechSoundCounter = 1, - kMaxSoundVolume = 127 + kMaxSoundVolume = 127, + kLastSaveSlot = 99 }; enum Verb { |