diff options
author | Torbjörn Andersson | 2008-10-13 04:24:18 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2008-10-13 04:24:18 +0000 |
commit | dc75da434848ecd90e5a65077d55ccc610fd335f (patch) | |
tree | 3247be129b34cf252489c993132d76f996cea616 | |
parent | 4a56e0d9c191d20d1b486739977ae8935e371a48 (diff) | |
download | scummvm-rg350-dc75da434848ecd90e5a65077d55ccc610fd335f.tar.gz scummvm-rg350-dc75da434848ecd90e5a65077d55ccc610fd335f.tar.bz2 scummvm-rg350-dc75da434848ecd90e5a65077d55ccc610fd335f.zip |
Use the save file manager's listSavefiles() function to find out if any savegames
exist at all. (The old method was to potentially try and open a hundred files,
though it would stop after finding the first one.)
svn-id: r34790
-rw-r--r-- | engines/sword2/saveload.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/engines/sword2/saveload.cpp b/engines/sword2/saveload.cpp index 73da5dd98b..e9d184f9d6 100644 --- a/engines/sword2/saveload.cpp +++ b/engines/sword2/saveload.cpp @@ -388,15 +388,14 @@ uint32 Sword2Engine::getSaveDescription(uint16 slotNo, byte *description) { } bool Sword2Engine::saveExists() { - for (int i = 0; i <= 99; i++) - if (saveExists(i)) - return true; - return false; + Common::String pattern = _targetName + ".???"; + Common::StringList filenames = _saveFileMan->listSavefiles(pattern.c_str()); + + return !filenames.empty(); } bool Sword2Engine::saveExists(uint16 slotNo) { char *saveFileName = getSaveFileName(slotNo); - Common::InSaveFile *in; if (!(in = _saveFileMan->openForLoading(saveFileName))) { |