Permalink
Browse files

MUTATIONOFJB: Small fixes.

Handle errors in save/load code.
Fix typo in Game::colorFromString.
  • Loading branch information...
LubomirR committed Sep 6, 2018
1 parent c36fb36 commit c239a18620a9ecbfc0a160647263aa59180112df
Showing with 8 additions and 4 deletions.
  1. +1 −1 engines/mutationofjb/game.cpp
  2. +0 −2 engines/mutationofjb/gamedata.h
  3. +7 −1 engines/mutationofjb/mutationofjb.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},
@@ -50,8 +50,6 @@ enum {
* An interactable scene changer with no visual representation.
*/
struct Door : public Common::Serializable {
virtual ~Door() {}
/**
* Door name (NM register).
*
@@ -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.
}

0 comments on commit c239a18

Please sign in to comment.