diff options
author | Ľubomír Remák | 2018-09-06 20:38:33 +0200 |
---|---|---|
committer | Ľubomír Remák | 2018-09-06 20:38:33 +0200 |
commit | c239a18620a9ecbfc0a160647263aa59180112df (patch) | |
tree | 84df177916a89069bf6aec30a73f9c67c9a85d36 | |
parent | c36fb36afba47f52c1f81f1df61eb31838134cd2 (diff) | |
download | scummvm-rg350-c239a18620a9ecbfc0a160647263aa59180112df.tar.gz scummvm-rg350-c239a18620a9ecbfc0a160647263aa59180112df.tar.bz2 scummvm-rg350-c239a18620a9ecbfc0a160647263aa59180112df.zip |
MUTATIONOFJB: Small fixes.
Handle errors in save/load code.
Fix typo in Game::colorFromString.
-rw-r--r-- | engines/mutationofjb/game.cpp | 2 | ||||
-rw-r--r-- | engines/mutationofjb/gamedata.h | 2 | ||||
-rw-r--r-- | engines/mutationofjb/mutationofjb.cpp | 8 |
3 files changed, 8 insertions, 4 deletions
diff --git a/engines/mutationofjb/game.cpp b/engines/mutationofjb/game.cpp index 5e0d1e699c..86755b1abd 100644 --- a/engines/mutationofjb/game.cpp +++ b/engines/mutationofjb/game.cpp @@ -212,7 +212,7 @@ uint8 Game::colorFromString(const char *colorStr) { uint8 color; } colors[] = { {"white", WHITE}, - {"dakrgray", DARKGRAY}, + {"darkgray", DARKGRAY}, {"lightgray", LIGHTGRAY}, {"green", GREEN}, {"orange", ORANGE}, diff --git a/engines/mutationofjb/gamedata.h b/engines/mutationofjb/gamedata.h index 3ba859b28e..f42e84b963 100644 --- a/engines/mutationofjb/gamedata.h +++ b/engines/mutationofjb/gamedata.h @@ -50,8 +50,6 @@ enum { * An interactable scene changer with no visual representation. */ struct Door : public Common::Serializable { - virtual ~Door() {} - /** * Door name (NM register). * diff --git a/engines/mutationofjb/mutationofjb.cpp b/engines/mutationofjb/mutationofjb.cpp index 84ef9742f1..ed4608b330 100644 --- a/engines/mutationofjb/mutationofjb.cpp +++ b/engines/mutationofjb/mutationofjb.cpp @@ -141,6 +141,8 @@ bool MutationOfJBEngine::canLoadGameStateCurrently() { Common::Error MutationOfJBEngine::loadGameState(int slot) { const Common::String saveName = Common::String::format("%s.%03d", _targetName.c_str(), slot); Common::InSaveFile *const saveFile = g_system->getSavefileManager()->openForLoading(saveName); + if (!saveFile) + return Common::kReadingFailed; Common::Serializer sz(saveFile, nullptr); @@ -162,6 +164,8 @@ bool MutationOfJBEngine::canSaveGameStateCurrently() { Common::Error MutationOfJBEngine::saveGameState(int slot, const Common::String &desc) { const Common::String saveName = Common::String::format("%s.%03d", _targetName.c_str(), slot); Common::OutSaveFile *const saveFile = g_system->getSavefileManager()->openForSaving(saveName); + if (!saveFile) + return Common::kWritingFailed; Common::Serializer sz(nullptr, saveFile); @@ -295,7 +299,9 @@ Common::Error MutationOfJBEngine::run() { setupCursor(); if (ConfMan.hasKey("save_slot")) { - loadGameState(ConfMan.getInt("save_slot")); + const Common::Error err = loadGameState(ConfMan.getInt("save_slot")); + if (err.getCode() != Common::kNoError) + return err; } else { _game->changeScene(13, false); // Initial scene. } |