From 938f222d4857b45e0f1f7e4726040ab0bf1d9b67 Mon Sep 17 00:00:00 2001 From: Ľubomír Remák Date: Thu, 22 Mar 2018 20:56:42 +0100 Subject: MUTATIONOFJB: Add support for calling macros. --- engines/mutationofjb/script.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'engines/mutationofjb/script.cpp') diff --git a/engines/mutationofjb/script.cpp b/engines/mutationofjb/script.cpp index 699daeb6c3..1291bd8d97 100644 --- a/engines/mutationofjb/script.cpp +++ b/engines/mutationofjb/script.cpp @@ -39,6 +39,7 @@ #include "mutationofjb/commands/labelcommand.h" #include "mutationofjb/commands/gotocommand.h" #include "mutationofjb/commands/camefromcommand.h" +#include "mutationofjb/commands/callmacrocommand.h" #include "mutationofjb/game.h" namespace MutationOfJB { @@ -49,6 +50,7 @@ static CommandParser **getParsers() { new IfItemCommandParser, new IfCommandParser, new CameFromCommandParser, + new CallMacroCommandParser, new EndBlockCommandParser, new ChangeDoorCommandParser, new ChangeObjectCommandParser, @@ -109,6 +111,10 @@ Command *ScriptExecutionContext::popReturnCommand() { return _stack.pop(); } +Game &ScriptExecutionContext::getGame() { + return _game; +} + GameData &ScriptExecutionContext::getGameData() { return _game.getGameData(); } @@ -206,4 +212,13 @@ const Macros &Script::getMacros() const { return _macros; } +Command *Script::getMacro(const Common::String &name) const { + Macros::const_iterator it = _macros.find(name); + if (it == _macros.end()) { + return nullptr; + } + + return it->_value; +} + } -- cgit v1.2.3