aboutsummaryrefslogtreecommitdiff
path: root/engines/touche/ui.cpp
diff options
context:
space:
mode:
authorDavid Corrales2007-07-12 17:58:15 +0000
committerDavid Corrales2007-07-12 17:58:15 +0000
commit720c974fafaca16b6e86f28ffc14c8c3aa574e15 (patch)
treed2d1ad9231fdc85099e12234ea14e5e50a89d8be /engines/touche/ui.cpp
parentc1961f1f76e91595624a2e49e48b0fab5f412f27 (diff)
downloadscummvm-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/touche/ui.cpp')
-rw-r--r--engines/touche/ui.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/engines/touche/ui.cpp b/engines/touche/ui.cpp
index 15dc64aaf2..4d7100d4d0 100644
--- a/engines/touche/ui.cpp
+++ b/engines/touche/ui.cpp
@@ -370,9 +370,33 @@ void ToucheEngine::handleOptions(int forceDisplay) {
setupMenu(menuData.mode, &menuData);
curMode = menuData.mode;
if (menuData.mode == kMenuLoadStateMode || menuData.mode == kMenuSaveStateMode) {
+ assert(menuData.saveLoadMarks);
+
char gameStateFileName[16];
generateGameStateFileName(999, gameStateFileName, 15, true);
- _saveFileMan->listSavefiles(gameStateFileName, menuData.saveLoadMarks, 100);
+ char slot[2];
+ int slotNum;
+ Common::StringList filenames;
+
+ memset(menuData.saveLoadMarks, false, 100 * sizeof(bool)); //assume no savegames for this title
+ filenames = _saveFileMan->listSavefiles(gameStateFileName);
+
+ for(Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++){
+ //Obtain the last 1 or 2 digits of the filename, since they correspond to the save slot
+ //This engine can save games either with one or two digits, hence the additional if statement
+ slot[0] = file->c_str()[file->size()-2];
+ slot[1] = file->c_str()[file->size()-1];
+
+ if(!atoi(&slot[0])){
+ slotNum = atoi(&slot[1]);
+ } else {
+ slotNum = atoi(slot);
+ }
+
+ if(slotNum >= 0 && slotNum < 100)
+ menuData.saveLoadMarks[slotNum] = true; //mark this slot as valid
+ }
+
for (int i = 0; i < 100; ++i) {
menuData.saveLoadDescriptionsTable[i][0] = 0;
if (menuData.saveLoadMarks[i]) {