MOHAWK: Add a convenience method for creating a script with a single command

This commit is contained in:
Bastien Bouclet 2016-11-05 08:33:34 +01:00 committed by Eugene Sandulenko
parent 14bbf8aab4
commit 6d4260719c
2 changed files with 15 additions and 0 deletions

View File

@ -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;
}

View File

@ -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);