diff options
author | Bastien Bouclet | 2016-11-05 08:33:34 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2017-07-03 08:50:10 +0200 |
commit | 6d4260719c79d457c1162feae2a91e7bbacae445 (patch) | |
tree | af08470410fa319a0e837bcf0ea573d50fc250a9 | |
parent | 14bbf8aab4ed187ec1e6da9e61a1acf6601d0332 (diff) | |
download | scummvm-rg350-6d4260719c79d457c1162feae2a91e7bbacae445.tar.gz scummvm-rg350-6d4260719c79d457c1162feae2a91e7bbacae445.tar.bz2 scummvm-rg350-6d4260719c79d457c1162feae2a91e7bbacae445.zip |
MOHAWK: Add a convenience method for creating a script with a single command
-rw-r--r-- | engines/mohawk/riven_scripts.cpp | 8 | ||||
-rw-r--r-- | engines/mohawk/riven_scripts.h | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp index c26d4bd827..67a56af1af 100644 --- a/engines/mohawk/riven_scripts.cpp +++ b/engines/mohawk/riven_scripts.cpp @@ -153,6 +153,14 @@ RivenScriptPtr RivenScriptManager::createScriptFromData(uint16 commandCount, ... return readScript(&readStream); } +RivenScriptPtr RivenScriptManager::createScriptWithCommand(RivenCommand *command) { + assert(command); + + RivenScriptPtr script = RivenScriptPtr(new RivenScript()); + script->addCommand(command); + return script; +} + RivenScript::RivenScript() { _continueRunning = true; } diff --git a/engines/mohawk/riven_scripts.h b/engines/mohawk/riven_scripts.h index cfe0f3a048..cac7955612 100644 --- a/engines/mohawk/riven_scripts.h +++ b/engines/mohawk/riven_scripts.h @@ -130,6 +130,13 @@ public: /** Create a script from the caller provided arguments containing raw data */ RivenScriptPtr createScriptFromData(uint16 commandCount, ...); + /** + * Create a script with a single user provided command + * + * The script takes ownership of the command. + */ + RivenScriptPtr createScriptWithCommand(RivenCommand *command); + /** Read a list of typed scripts from a stream */ RivenScriptList readScripts(Common::ReadStream *stream); |