aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage
diff options
context:
space:
mode:
authorPaul Gilbert2011-10-13 22:01:58 +1100
committerPaul Gilbert2011-10-13 22:01:58 +1100
commit3a372991ee3e133378b9a44f3a8b73a4ddc3aae5 (patch)
treee0f53a603d2b19b96fffdde690fdd3d6d312236b /engines/tsage
parent49f20aa2bd795a90865e4782db4c97e036fc89fc (diff)
downloadscummvm-rg350-3a372991ee3e133378b9a44f3a8b73a4ddc3aae5.tar.gz
scummvm-rg350-3a372991ee3e133378b9a44f3a8b73a4ddc3aae5.tar.bz2
scummvm-rg350-3a372991ee3e133378b9a44f3a8b73a4ddc3aae5.zip
TSAGE: Show an explicit error message when saving or loading savegames fails
Diffstat (limited to 'engines/tsage')
-rw-r--r--engines/tsage/saveload.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp
index c261d091dd..db52050b03 100644
--- a/engines/tsage/saveload.cpp
+++ b/engines/tsage/saveload.cpp
@@ -129,8 +129,12 @@ Common::Error Saver::save(int slot, const Common::String &saveName) {
_macroSaveFlag = true;
_saveSlot = slot;
- // Set up the serializer
+ // Try and create the save file
Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(g_vm->generateSaveName(slot));
+ if (!saveFile)
+ return Common::kCreatingFileFailed;
+
+ // Set up the serializer
Serializer serializer(NULL, saveFile);
serializer.setSaveVersion(TSAGE_SAVEGAME_VERSION);
@@ -177,6 +181,9 @@ Common::Error Saver::restore(int slot) {
// Set up the serializer
Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(g_vm->generateSaveName(slot));
+ if (!saveFile)
+ return Common::kReadingFailed;
+
Serializer serializer(saveFile, NULL);
// Read in the savegame header