aboutsummaryrefslogtreecommitdiff
path: root/engines/mortevielle
diff options
context:
space:
mode:
authorPaul Gilbert2012-01-20 10:53:54 +1100
committerStrangerke2012-04-06 08:20:04 +0200
commit0790b3f24a334c7a3b0fdbf631b786fe973f2d60 (patch)
tree44d1caf729cc00df5519842579e86402d0475276 /engines/mortevielle
parent64c0600c3c78c2c4b6d7855386bf4e000478cd5d (diff)
downloadscummvm-rg350-0790b3f24a334c7a3b0fdbf631b786fe973f2d60.tar.gz
scummvm-rg350-0790b3f24a334c7a3b0fdbf631b786fe973f2d60.tar.bz2
scummvm-rg350-0790b3f24a334c7a3b0fdbf631b786fe973f2d60.zip
MORTEVIELLE: Fix savegame loading to allow to read from the data folder
This is needed so that the initial game state can be correctly read from slot 0.
Diffstat (limited to 'engines/mortevielle')
-rw-r--r--engines/mortevielle/disk.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/engines/mortevielle/disk.cpp b/engines/mortevielle/disk.cpp
index 8a889f2130..41868d42fa 100644
--- a/engines/mortevielle/disk.cpp
+++ b/engines/mortevielle/disk.cpp
@@ -87,19 +87,28 @@ void takesav(int n) {
dem1();
// -- Load the file 'sauve#n.mor'
Common::String saveName = Common::String::format("sav%d.mor", n);
- Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(saveName);
- Common::Serializer sz(f, NULL);
- sync_save(sz);
+ // Try loading first from the save area
+ Common::SeekableReadStream *stream = g_system->getSavefileManager()->openForLoading(saveName);
+
+ // If not present, try loading from the program folder
+ Common::File f;
+ if (stream == NULL) {
+ if (!f.open(saveName))
+ error("Unable to open save file '%s'", saveName);
- if (f->err()) {
- i = do_alert(err_mess, 1);
- mortevielle_exit(0);
+ stream = f.readStream(f.size());
+ f.close();
}
+
+ Common::Serializer sz(stream, NULL);
+ sync_save(sz);
+
s = s1;
for (i = 0; i <= 389; i ++) tabdon[i + acha] = bufcha[i];
- delete f;
+ // Close the stream
+ delete stream;
}
void ld_game(int n) {