diff options
-rw-r--r-- | engines/sci/console.cpp | 10 | ||||
-rw-r--r-- | engines/sci/detection.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/kfile.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cpp | 6 | ||||
-rw-r--r-- | engines/sci/engine/savegame.h | 2 |
5 files changed, 7 insertions, 15 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index a3e33b13c8..0c017af281 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -1085,7 +1085,7 @@ bool Console::cmdSaveGame(int argc, const char **argv) { } // TODO: enable custom descriptions? force filename into a specific format? - if (gamestate_save(_engine->_gamestate, out, "debugging", version)) { + if (!gamestate_save(_engine->_gamestate, out, "debugging", version)) { DebugPrintf("Saving the game state to '%s' failed\n", argv[1]); } else { out->finalize(); @@ -1095,14 +1095,6 @@ bool Console::cmdSaveGame(int argc, const char **argv) { delete out; } - out->finalize(); - if (out->err()) { - delete out; - warning("Writing the savegame failed."); - } else { - delete out; - } - return true; } diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index 7f0a27c14f..b402f7cc0b 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -659,7 +659,7 @@ Common::Error SciEngine::saveGameState(int slot, const char *desc) { return Common::kWritingFailed; } - if (gamestate_save(_gamestate, out, desc, version)) { + if (!gamestate_save(_gamestate, out, desc, version)) { warning("Saving the game state to '%s' failed", fileName.c_str()); return Common::kWritingFailed; } else { diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index 3e0ecd1a28..ad188f503a 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -543,7 +543,7 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) { return NULL_REG; } - if (gamestate_save(s, out, game_description.c_str(), version.c_str())) { + if (!gamestate_save(s, out, game_description.c_str(), version.c_str())) { warning("Saving the game failed."); s->r_acc = NULL_REG; } else { diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 155c5fad86..d2bd955793 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -860,7 +860,7 @@ static void reconstruct_sounds(EngineState *s) { #pragma mark - -int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename, const char *version) { +bool gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename, const char *version) { TimeDate curTime; g_system->getTimeAndDate(curTime); @@ -877,7 +877,7 @@ int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename if (s->executionStackBase) { warning("Cannot save from below kernel function"); - return 1; + return false; } Common::Serializer ser(0, fh); @@ -885,7 +885,7 @@ int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename Graphics::saveThumbnail(*fh); s->saveLoadWithSerializer(ser); // FIXME: Error handling? - return 0; + return true; } void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { diff --git a/engines/sci/engine/savegame.h b/engines/sci/engine/savegame.h index c8c7738fdf..aa22d42135 100644 --- a/engines/sci/engine/savegame.h +++ b/engines/sci/engine/savegame.h @@ -59,7 +59,7 @@ struct SavegameMetadata { * @param savename The description of the savegame * @return 0 on success, 1 otherwise */ -int gamestate_save(EngineState *s, Common::WriteStream *save, const char *savename, const char *version); +bool gamestate_save(EngineState *s, Common::WriteStream *save, const char *savename, const char *version); /** * Restores a game state from a directory. |