aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorD G Turner2014-03-18 22:49:36 +0000
committerD G Turner2014-03-18 22:49:36 +0000
commitf4e7b593dc9d841640bda26da59de716772b4411 (patch)
tree40319c8e2840375a0d6d127eaa383391142ac907 /engines/scumm
parentc7d1ca9f6588ce99901c9223a988e260d47c7c2e (diff)
downloadscummvm-rg350-f4e7b593dc9d841640bda26da59de716772b4411.tar.gz
scummvm-rg350-f4e7b593dc9d841640bda26da59de716772b4411.tar.bz2
scummvm-rg350-f4e7b593dc9d841640bda26da59de716772b4411.zip
SCUMM: Fix bug #6009 "DC: FT/Dig - Sound disappears when VMU save fails"
This was introduced by fd3970aa52a0c7f411afdddfebad208f783281c8: Apply patch #2984508 - "GSoC: SCUMM stopped audio from playing while saving" This was not quite correct as if the save fails, the function exits without unpausing the engine, which resulted in sound and music remaining muted. This corrects the logic to unpause in all cases.
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/saveload.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index 67bd6f617d..8d278f6ddf 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -188,32 +188,31 @@ bool ScummEngine::saveState(Common::WriteStream *out, bool writeHeader) {
}
bool ScummEngine::saveState(int slot, bool compat, Common::String &filename) {
- bool saveFailed;
+ bool saveFailed = false;
pauseEngine(true);
Common::WriteStream *out = openSaveFileForWriting(slot, compat, filename);
- if (!out)
- return false;
-
- saveFailed = false;
- if (!saveState(out))
+ if (!out) {
saveFailed = true;
+ } else {
+ if (!saveState(out))
+ saveFailed = true;
- out->finalize();
- if (out->err())
- saveFailed = true;
- delete out;
+ out->finalize();
+ if (out->err())
+ saveFailed = true;
+ delete out;
+ }
- if (saveFailed) {
+ if (saveFailed)
debug(1, "State save as '%s' FAILED", filename.c_str());
- return false;
- }
- debug(1, "State saved as '%s'", filename.c_str());
+ else
+ debug(1, "State saved as '%s'", filename.c_str());
pauseEngine(false);
- return true;
+ return !saveFailed;
}