diff options
author | Max Horn | 2007-09-18 20:02:04 +0000 |
---|---|---|
committer | Max Horn | 2007-09-18 20:02:04 +0000 |
commit | c3d3aebe87d16d4fc3b7ac8581b99fb97241c9ac (patch) | |
tree | 17b2ba9f45743d2cf8f8e5faa6c9511e213f15f3 /engines/agos | |
parent | 5c08cb1bcf84828cc93114fadbc89dd6f9909d06 (diff) | |
parent | 1dc13a641dd82825334e81bb3eb3b4ebd69d2552 (diff) | |
download | scummvm-rg350-c3d3aebe87d16d4fc3b7ac8581b99fb97241c9ac.tar.gz scummvm-rg350-c3d3aebe87d16d4fc3b7ac8581b99fb97241c9ac.tar.bz2 scummvm-rg350-c3d3aebe87d16d4fc3b7ac8581b99fb97241c9ac.zip |
Patch #1768757: Merge fsnode-gsoc into trunk (MAJOR change, will break compilation on some ports)
svn-id: r28944
Diffstat (limited to 'engines/agos')
-rw-r--r-- | engines/agos/saveload.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp index 3715088ee7..f7c2d4846f 100644 --- a/engines/agos/saveload.cpp +++ b/engines/agos/saveload.cpp @@ -38,13 +38,29 @@ namespace AGOS { int AGOSEngine::countSaveGames() { Common::InSaveFile *f; + Common::StringList filenames; uint i = 1; + char slot[3]; + int slotNum; bool marks[256]; char *prefix = genSaveName(998); - prefix[strlen(prefix)-3] = '\0'; - _saveFileMan->listSavefiles(prefix, marks, 256); - + prefix[strlen(prefix)-3] = '*'; + prefix[strlen(prefix)-2] = '\0'; + memset(marks, false, 256 * sizeof(bool)); //assume no savegames for this title + filenames = _saveFileMan->listSavefiles(prefix); + + for(Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++){ + //Obtain the last 3 digits of the filename, since they correspond to the save slot + slot[0] = file->c_str()[file->size()-3]; + slot[1] = file->c_str()[file->size()-2]; + slot[2] = file->c_str()[file->size()-1]; + + slotNum = atoi(slot); + if(slotNum >= 0 && slotNum < 256) + marks[slotNum] = true; //mark this slot as valid + } + while (i < 256) { if (marks[i] && (f = _saveFileMan->openForLoading(genSaveName(i)))) { @@ -53,6 +69,7 @@ int AGOSEngine::countSaveGames() { } else break; } + return i; } |