diff options
author | David Corrales | 2007-07-12 17:58:15 +0000 |
---|---|---|
committer | David Corrales | 2007-07-12 17:58:15 +0000 |
commit | 720c974fafaca16b6e86f28ffc14c8c3aa574e15 (patch) | |
tree | d2d1ad9231fdc85099e12234ea14e5e50a89d8be /engines/queen/queen.cpp | |
parent | c1961f1f76e91595624a2e49e48b0fab5f412f27 (diff) | |
download | scummvm-rg350-720c974fafaca16b6e86f28ffc14c8c3aa574e15.tar.gz scummvm-rg350-720c974fafaca16b6e86f28ffc14c8c3aa574e15.tar.bz2 scummvm-rg350-720c974fafaca16b6e86f28ffc14c8c3aa574e15.zip |
Changed SaveFileManager::listSavegames() function to be engine agnostic. It now returns a list will the full paths of existing files that match a given regex.
Additionally, modified the 5 engines which use the default manager (Agos, Queen, Saga, Scumm and Touche) to parse the filename list and mark the available saves bool array correctly.
svn-id: r28046
Diffstat (limited to 'engines/queen/queen.cpp')
-rw-r--r-- | engines/queen/queen.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index c1e909ffdb..7ba89b7af9 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -317,11 +317,28 @@ void QueenEngine::makeGameStateName(uint16 slot, char *buf) { } void QueenEngine::findGameStateDescriptions(char descriptions[100][32]) { - char filename[20]; - makeGameStateName(0, filename); - filename[strlen(filename) - 2] = 0; + char prefix[20]; + makeGameStateName(0, prefix); + prefix[strlen(prefix) - 2] = '*'; + prefix[strlen(prefix) - 1] = 0; bool marks[SAVESTATE_MAX_NUM]; - _saveFileMan->listSavefiles(filename, marks, SAVESTATE_MAX_NUM); + char slot[2]; + int slotNum; + Common::StringList filenames; + + memset(marks, false, SAVESTATE_MAX_NUM * 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 2 digits of the filename, since they correspond to the save slot + slot[0] = file->c_str()[file->size()-2]; + slot[1] = file->c_str()[file->size()-1]; + + slotNum = atoi(slot); + if(slotNum >= 0 && slotNum < SAVESTATE_MAX_NUM) + marks[slotNum] = true; //mark this slot as valid + } + for (int i = 0; i < SAVESTATE_MAX_NUM; ++i) { if (marks[i]) { GameStateHeader header; |