From b70f85b9a0775212f47c25f5218e63b117d0c696 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 1 Jul 2013 17:18:21 -0500 Subject: ZVISION: Comment clarification for ScriptManager methods and helper structs --- engines/zvision/scrFileHandling.cpp | 4 +-- engines/zvision/scriptManager.h | 63 +++++++++++++++++++------------------ 2 files changed, 35 insertions(+), 32 deletions(-) (limited to 'engines') diff --git a/engines/zvision/scrFileHandling.cpp b/engines/zvision/scrFileHandling.cpp index c511a2e641..61feb12b7e 100644 --- a/engines/zvision/scrFileHandling.cpp +++ b/engines/zvision/scrFileHandling.cpp @@ -113,10 +113,10 @@ Criteria ScriptManager::parseCriteria(Common::SeekableReadStream &stream) const token = tokenizer.nextToken(); if (token.contains('[')) { sscanf(token.c_str(), "[%u]", &(criteria.argument)); - criteria.argumentIsAnId = true; + criteria.isArgumentAnId = true; } else { sscanf(token.c_str(), "%u", &(criteria.argument)); - criteria.argumentIsAnId = false; + criteria.isArgumentAnId = false; } line = stream.readLine(); diff --git a/engines/zvision/scriptManager.h b/engines/zvision/scriptManager.h index 0bae91945d..563a010de5 100644 --- a/engines/zvision/scriptManager.h +++ b/engines/zvision/scriptManager.h @@ -29,17 +29,27 @@ #include "zvision/puzzle.h" #include "zvision/control.h" +#include "zvision/singleValueContainer.h" namespace ZVision { class ScriptManager { -public: - ScriptManager(); - ~ScriptManager(); - private: + /** Holds the global state variables. Optimize for fast random access */ Common::HashMap _globalState; + /** Holds the currently active puzzles. Optimize for fast iteration */ + Common::List _puzzles; + /** Holds the currently active controls. Optimize for fast iteration */ + Common::List _controls; +public: + + void initialize(); + byte getStateValue(uint32 key); + void setStateValue(uint32 key, byte value); + void addToStateValue(uint32 key, byte valueToAdd); + +private: /** * Parses a script file into triggers and events * @@ -48,54 +58,47 @@ private: void parseScrFile(Common::String fileName); /** - * Helper method for parseScrFile. Parses the stream into a Puzzle object + * Parses the stream into a Puzzle object + * Helper method for parseScrFile. * - * @param puzzle The object to store what is parsed - * @param stream Scr file stream + * @param puzzle The object to store what is parsed + * @param stream Scr file stream */ - void parsePuzzle(Puzzle *puzzle, Common::SeekableReadStream &stream); + void parsePuzzle(Puzzle &puzzle, Common::SeekableReadStream &stream); /** - * Helper method for parsePuzzle. Parses the stream into a Criteria object + * Parses the stream into a Criteria object + * Helper method for parsePuzzle. * - * @param stream Scr file stream - * @return Created Criteria object + * @param stream Scr file stream + * @return Created Criteria object */ Criteria parseCriteria(Common::SeekableReadStream &stream) const; /** - * Helper method for parsePuzzle. Parses the stream into a Results object - * - * @param stream Scr file stream - * @return Created Results object - */ - Result parseResult(Common::SeekableReadStream &stream) const; - - /** - * Helper method for parseResults. Parses a number of strings into Object types. + * Parses the stream into a Results object + * Helper method for parsePuzzle. * - * @param result Results object to store the arguments in - * @param types The type of the each of the arguments. IE. BOOL, UINT32, etc. - * @param numberOfArgs The number of arguments. This has to equal the length of 'types' AND the number of optional arguments passed. - * @param String arguments wanting to be parsed + * @param stream Scr file stream + * @return Created Results object */ - void parseResultArguments(Result &result, const ObjectType *types, int numberOfArgs, ...) const; + void parseResult(Common::SeekableReadStream &stream, Common::List &actionList) const; /** * Helper method for parsePuzzle. Parses the stream into a bitwise or of the StateFlags enum * - * @param stream Scr file stream - * @return Bitwise or of all the flags set within the puzzle + * @param stream Scr file stream + * @return Bitwise or of all the flags set within the puzzle */ byte parseFlags(Common::SeekableReadStream &stream) const; /** * Helper method for parseScrFile. Parses the stream into a Control object * - * @param control The object to store what is parsed - * @param stream Scr file stream + * @param control The object to store what is parsed + * @param stream Scr file stream */ - void parseControl(Control *control, Common::SeekableReadStream &stream); + void parseControl(Control &control, Common::SeekableReadStream &stream); }; -- cgit v1.2.3