diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp index 845fc524e147..34e398de91e2 100644 --- a/engines/adl/adl.cpp +++ b/engines/adl/adl.cpp @@ -58,7 +58,7 @@ AdlEngine::AdlEngine(OSystem *syst, const AdlGameDescription *gd) : _isRestarting(false), _isRestoring(false), _isQuitting(false), - _skipOneCommand(false), + _abortScript(false), _gameDescription(gd), _console(nullptr), _messageIds(), @@ -1320,20 +1320,18 @@ bool AdlEngine::doOneCommand(const Commands &commands, byte verb, byte noun) { Commands::const_iterator cmd; for (cmd = commands.begin(); cmd != commands.end(); ++cmd) { - - if (_skipOneCommand) { - _skipOneCommand = false; - continue; - } - ScriptEnv env(*cmd, _state.room, verb, noun); if (matchCommand(env)) { doActions(env); return true; } + + if (_abortScript) { + _abortScript = false; + return false; + } } - _skipOneCommand = false; return false; } @@ -1341,11 +1339,6 @@ void AdlEngine::doAllCommands(const Commands &commands, byte verb, byte noun) { Commands::const_iterator cmd; for (cmd = commands.begin(); cmd != commands.end(); ++cmd) { - if (_skipOneCommand) { - _skipOneCommand = false; - continue; - } - ScriptEnv env(*cmd, _state.room, verb, noun); if (matchCommand(env)) { doActions(env); @@ -1353,9 +1346,12 @@ void AdlEngine::doAllCommands(const Commands &commands, byte verb, byte noun) { if (_isRestarting) return; } - } - _skipOneCommand = false; + if (_abortScript) { + _abortScript = false; + return; + } + } } Common::String AdlEngine::toAscii(const Common::String &str) { diff --git a/engines/adl/adl.h b/engines/adl/adl.h index 3630cd69b93c..75df3395d7eb 100644 --- a/engines/adl/adl.h +++ b/engines/adl/adl.h @@ -391,7 +391,7 @@ friend class Console; bool _isRestarting, _isRestoring, _isQuitting; bool _canSaveNow, _canRestoreNow; - bool _skipOneCommand; + bool _abortScript; const AdlGameDescription *_gameDescription; diff --git a/engines/adl/adl_v5.cpp b/engines/adl/adl_v5.cpp index 795899c07065..be0c31a64cbb 100644 --- a/engines/adl/adl_v5.cpp +++ b/engines/adl/adl_v5.cpp @@ -66,7 +66,7 @@ void AdlEngine_v5::setupOpcodeTables() { // 0x08 Opcode(o4_isVarGT); Opcode(o1_isCurPicEQ); - Opcode(o5_skipOneCommand); + Opcode(o5_abortScript); SetOpcodeTable(_actOpcodes); // 0x00 @@ -131,10 +131,10 @@ int AdlEngine_v5::o5_isNounNotInRoom(ScriptEnv &e) { return 1; } -int AdlEngine_v5::o5_skipOneCommand(ScriptEnv &e) { - OP_DEBUG_0("\t&& SKIP_ONE_COMMAND()"); +int AdlEngine_v5::o5_abortScript(ScriptEnv &e) { + OP_DEBUG_0("\t&& ABORT_SCRIPT()"); - _skipOneCommand = true; + _abortScript = true; setVar(2, 0); return -1; diff --git a/engines/adl/adl_v5.h b/engines/adl/adl_v5.h index bb1cc3015a22..7836ec6b0445 100644 --- a/engines/adl/adl_v5.h +++ b/engines/adl/adl_v5.h @@ -41,7 +41,7 @@ class AdlEngine_v5 : public AdlEngine_v4 { virtual RegionChunkType getRegionChunkType(const uint16 addr) const; int o5_isNounNotInRoom(ScriptEnv &e); - int o5_skipOneCommand(ScriptEnv &e); + int o5_abortScript(ScriptEnv &e); int o5_dummy(ScriptEnv &e); int o5_setTextMode(ScriptEnv &e); int o5_setRegionRoom(ScriptEnv &e);