diff options
author | Walter van Niftrik | 2016-03-08 15:09:52 +0100 |
---|---|---|
committer | Walter van Niftrik | 2016-03-09 10:03:13 +0100 |
commit | 349245d9b42dbe72f8aaa9c8a7a1fe09f60c9787 (patch) | |
tree | 89017758a6d8bdedf8fa41215261b89a78bf9add /engines | |
parent | 9d65f901d08955a78841581a4c05b1139b3fb41a (diff) | |
download | scummvm-rg350-349245d9b42dbe72f8aaa9c8a7a1fe09f60c9787.tar.gz scummvm-rg350-349245d9b42dbe72f8aaa9c8a7a1fe09f60c9787.tar.bz2 scummvm-rg350-349245d9b42dbe72f8aaa9c8a7a1fe09f60c9787.zip |
ADL: Fix regression in GMM saving/loading
Diffstat (limited to 'engines')
-rw-r--r-- | engines/adl/adl.cpp | 22 | ||||
-rw-r--r-- | engines/adl/adl.h | 4 |
2 files changed, 14 insertions, 12 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp index e9401cbc4d..8e374fa8f6 100644 --- a/engines/adl/adl.cpp +++ b/engines/adl/adl.cpp @@ -302,8 +302,11 @@ Common::Error AdlEngine::run() { if (shouldQuit()) break; - if (!doOneCommand(_roomCommands, verb, noun)) - printMessage(_messageIds.dontUnderstand); + // If we just restored from the GMM, we skip this command + // set, as no command has been input by the user + if (!_isRestoring) + if (!doOneCommand(_roomCommands, verb, noun)) + printMessage(_messageIds.dontUnderstand); } if (_isRestoring) { @@ -419,7 +422,7 @@ Common::Error AdlEngine::loadGameState(int slot) { return Common::kNoError; } -bool AdlEngine::canLoadGameStateCurrently() const { +bool AdlEngine::canLoadGameStateCurrently() { return _canRestoreNow; } @@ -496,7 +499,7 @@ Common::Error AdlEngine::saveGameState(int slot, const Common::String &desc) { return Common::kNoError; } -bool AdlEngine::canSaveGameStateCurrently() const { +bool AdlEngine::canSaveGameStateCurrently() { if (!_canSaveNow) return false; @@ -506,11 +509,9 @@ bool AdlEngine::canSaveGameStateCurrently() const { // "SAVE GAME". This prevents saving via the GMM in situations where // it wouldn't otherwise be possible to do so. for (cmd = _roomCommands.begin(); cmd != _roomCommands.end(); ++cmd) { - if (matchCommand(*cmd, _saveVerb, _saveNoun)) { - if (cmd->verb != _saveVerb || cmd->noun != _saveNoun) - return false; - return cmd->numCond == 0 && cmd->script[0] == IDO_ACT_SAVE; - } + uint offset; + if (matchCommand(*cmd, _saveVerb, _saveNoun, &offset)) + return cmd->script[offset] == IDO_ACT_SAVE; } return false; @@ -870,7 +871,8 @@ bool AdlEngine::matchCommand(const Command &command, byte verb, byte noun, uint } } - *actions = offset; + if (actions) + *actions = offset; return true; } diff --git a/engines/adl/adl.h b/engines/adl/adl.h index 8064375843..4ea7566669 100644 --- a/engines/adl/adl.h +++ b/engines/adl/adl.h @@ -198,9 +198,9 @@ private: Common::Error run(); bool hasFeature(EngineFeature f) const; Common::Error loadGameState(int slot); - bool canLoadGameStateCurrently() const; + bool canLoadGameStateCurrently(); Common::Error saveGameState(int slot, const Common::String &desc); - bool canSaveGameStateCurrently() const; + bool canSaveGameStateCurrently(); // Text output void wordWrap(Common::String &str) const; |