diff options
author | whiterandrek | 2018-06-21 17:15:14 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | 9e920d9349a6c9fb99f41e3acedd245fbe439e93 (patch) | |
tree | fd4598978e75c1537401a0a45fa4a688c2f9946d /engines | |
parent | a8cbdba16f466ba5503f981ebe5d6f079b31dd9b (diff) | |
download | scummvm-rg350-9e920d9349a6c9fb99f41e3acedd245fbe439e93.tar.gz scummvm-rg350-9e920d9349a6c9fb99f41e3acedd245fbe439e93.tar.bz2 scummvm-rg350-9e920d9349a6c9fb99f41e3acedd245fbe439e93.zip |
PINK: add commands to list and set game variables
Diffstat (limited to 'engines')
-rw-r--r-- | engines/pink/console.cpp | 24 | ||||
-rw-r--r-- | engines/pink/console.h | 3 |
2 files changed, 25 insertions, 2 deletions
diff --git a/engines/pink/console.cpp b/engines/pink/console.cpp index de95b9ab4b..66413dbac1 100644 --- a/engines/pink/console.cpp +++ b/engines/pink/console.cpp @@ -29,6 +29,9 @@ Console::Console(PinkEngine *vm) : _vm(vm) { registerCmd("listModules", WRAP_METHOD(Console, Cmd_ListModules)); registerCmd("goToModule", WRAP_METHOD(Console, Cmd_GoToModule)); + + registerCmd("listGameVars", WRAP_METHOD(Console, Cmd_ListGameVars)); + registerCmd("setGameVar", WRAP_METHOD(Console, Cmd_SetGameVar)); } bool Console::Cmd_ListModules(int argc, const char **argv) { @@ -42,7 +45,7 @@ bool Console::Cmd_ListModules(int argc, const char **argv) { bool Console::Cmd_GoToModule(int argc, const char **argv) { if (argc != 2) { debugPrintf("Usage: %s moduleName\n", argv[0]); - debugPrintf("Module may not work properly because of Game vars"); + debugPrintf("Module may not work properly because of Game vars\n"); return true; } const Array<NamedObject*> modules = _vm->_modules; @@ -52,7 +55,24 @@ bool Console::Cmd_GoToModule(int argc, const char **argv) { return true; } } - debugPrintf("Module %s doesn't exist", argv[1]); + debugPrintf("Module %s doesn't exist\n", argv[1]); + return true; +} + +bool Console::Cmd_ListGameVars(int argc, const char **argv) { + const StringMap &vars = _vm->_variables; + for (StringMap::const_iterator it = vars.begin(); it != vars.end() ; ++it) { + debugPrintf("%s %s \n", it->_key.c_str(), it->_value.c_str()); + } + return true; +} + +bool Console::Cmd_SetGameVar(int argc, const char **argv) { + if (argc != 3) { + debugPrintf("Usage: %s varName value\n", argv[0]); + return true; + } + _vm->_variables[argv[1]] = argv[2]; return true; } diff --git a/engines/pink/console.h b/engines/pink/console.h index 9c438a890c..73041a5719 100644 --- a/engines/pink/console.h +++ b/engines/pink/console.h @@ -39,6 +39,9 @@ private: bool Cmd_ListModules(int argc, const char **argv); bool Cmd_GoToModule(int argc, const char **argv); + bool Cmd_ListGameVars(int argc, const char **argv); + bool Cmd_SetGameVar(int argc, const char **argv); + private: PinkEngine *_vm; }; |