aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/saveload.cpp
diff options
context:
space:
mode:
authorKamil Zbrog2014-03-29 22:13:07 +0100
committerKamil Zbrog2014-03-29 22:13:07 +0100
commit5ffa58dba7a941249af9ca8c1bd229c310fb296b (patch)
tree49faae8eb3424c32d890b4d3cd1eefeb11fc3cd9 /engines/scumm/saveload.cpp
parent8eac80cfc59c34299899ebe18a3b0582ef76e0d2 (diff)
parent620411bfebe72fb0f60c4d8f64558be088cff58d (diff)
downloadscummvm-rg350-5ffa58dba7a941249af9ca8c1bd229c310fb296b.tar.gz
scummvm-rg350-5ffa58dba7a941249af9ca8c1bd229c310fb296b.tar.bz2
scummvm-rg350-5ffa58dba7a941249af9ca8c1bd229c310fb296b.zip
Merge remote-tracking branch 'sync/master' into prince-malik
Diffstat (limited to 'engines/scumm/saveload.cpp')
-rw-r--r--engines/scumm/saveload.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index 848e288589..8d278f6ddf 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -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;
}