aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBorja Lorente2016-08-02 13:15:43 +0200
committerBorja Lorente2016-08-14 19:00:37 +0200
commit0acdf0c459eaf96c0b181cd3a6a94ba58a97475b (patch)
tree4d138c5bf8aa395dfa785e6f5150545bdb0a2c9a
parent9ab6ce04a11de0bf5f56a7866a4837c7431cefbe (diff)
downloadscummvm-rg350-0acdf0c459eaf96c0b181cd3a6a94ba58a97475b.tar.gz
scummvm-rg350-0acdf0c459eaf96c0b181cd3a6a94ba58a97475b.tar.bz2
scummvm-rg350-0acdf0c459eaf96c0b181cd3a6a94ba58a97475b.zip
MACVENTURE: Implement savefile deletion
-rw-r--r--engines/macventure/detection.cpp8
-rw-r--r--engines/macventure/saveload.cpp5
2 files changed, 12 insertions, 1 deletions
diff --git a/engines/macventure/detection.cpp b/engines/macventure/detection.cpp
index 082a8acc65..f4edaefa40 100644
--- a/engines/macventure/detection.cpp
+++ b/engines/macventure/detection.cpp
@@ -65,12 +65,14 @@ public:
virtual bool hasFeature(MetaEngineFeature f) const;
virtual SaveStateList listSaves(const char *target) const;
virtual int getMaximumSaveSlot() const;
+ virtual void removeSaveState(const char *target, int slot) const;
};
bool MacVentureMetaEngine::hasFeature(MetaEngineFeature f) const {
return
(f == kSupportsListSaves) ||
- (f == kSupportsLoadingDuringStartup);
+ (f == kSupportsLoadingDuringStartup) ||
+ (f == kSupportsDeleteSave);
}
bool MacVentureEngine::hasFeature(EngineFeature f) const {
@@ -127,6 +129,10 @@ bool MacVentureMetaEngine::createInstance(OSystem * syst, Engine ** engine, cons
return game != 0;
}
+void MacVentureMetaEngine::removeSaveState(const char *target, int slot) const {
+ g_system->getSavefileManager()->removeSavefile(Common::String::format("%s.%03d", target, slot));
+}
+
} // End of namespace MacVenture
#if PLUGIN_ENABLED_DYNAMIC(MACVENTURE)
diff --git a/engines/macventure/saveload.cpp b/engines/macventure/saveload.cpp
index e1b6227851..1322a43510 100644
--- a/engines/macventure/saveload.cpp
+++ b/engines/macventure/saveload.cpp
@@ -89,6 +89,11 @@ Common::Error MacVentureEngine::saveGameState(int slot, const Common::String &de
Common::OutSaveFile *file = manager->openForSaving(saveFileName);
_world->saveGameInto(file);
writeMetaData(file, desc);
+
+ file->finalize();
+ if (file->err()) {
+ warning("Could not save '%s' correctly.", saveFileName.c_str());
+ }
delete file;
}