aboutsummaryrefslogtreecommitdiff
path: root/engines/saga/detection.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2008-11-07 19:43:01 +0000
committerFilippos Karapetis2008-11-07 19:43:01 +0000
commit57e57c49cee547a9b48ebdedeea6b8bc2d9892fa (patch)
treeccc9e579585253fc68bd9b1ba9317bfded7d8615 /engines/saga/detection.cpp
parente6337d11aa74322dc6e362ede199a9f4c4ebc5cf (diff)
downloadscummvm-rg350-57e57c49cee547a9b48ebdedeea6b8bc2d9892fa.tar.gz
scummvm-rg350-57e57c49cee547a9b48ebdedeea6b8bc2d9892fa.tar.bz2
scummvm-rg350-57e57c49cee547a9b48ebdedeea6b8bc2d9892fa.zip
Saving a game from GMM is now working for the SAGA engine, though the description is not set correctly yet
svn-id: r34932
Diffstat (limited to 'engines/saga/detection.cpp')
-rw-r--r--engines/saga/detection.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp
index c49661a052..b7503278e7 100644
--- a/engines/saga/detection.cpp
+++ b/engines/saga/detection.cpp
@@ -187,9 +187,10 @@ SaveStateList SagaMetaEngine::listSaves(const char *target) const {
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
SaveStateList saveList;
+ int slotNum = 0;
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
- int slotNum = atoi(file->c_str() + file->size() - 2);
+ slotNum = atoi(file->c_str() + file->size() - 2);
if (slotNum >= 0 && slotNum <= 99) {
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
@@ -199,10 +200,20 @@ SaveStateList SagaMetaEngine::listSaves(const char *target) const {
in->read(saveDesc, SAVE_TITLE_SIZE);
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
delete in;
+ } else {
+ // handle gaps
+ *saveDesc = 0;
+ saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
}
}
}
+ // Fill the rest of the list with empty slots
+ *saveDesc = 0;
+ for (int i = slotNum + 1; i <= 99; i++) {
+ saveList.push_back(SaveStateDescriptor(i, saveDesc));
+ }
+
return saveList;
}
@@ -265,4 +276,9 @@ Common::Error SagaEngine::loadGameState(int slot) {
return Common::kNoError; // TODO: return success/failure
}
+Common::Error SagaEngine::saveGameState(int slot, const char *desc) {
+ save(calcSaveFileName((uint)slot), desc);
+ return Common::kNoError; // TODO: return success/failure
+}
+
} // End of namespace Saga