From 6d4260719c79d457c1162feae2a91e7bbacae445 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sat, 5 Nov 2016 08:33:34 +0100 Subject: MOHAWK: Add a convenience method for creating a script with a single command --- engines/mohawk/riven_scripts.cpp | 8 ++++++++ engines/mohawk/riven_scripts.h | 7 +++++++ 2 files changed, 15 insertions(+) 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); -- cgit v1.2.3