ZVISION: Create main containers in ScriptManager

This commit is contained in:
richiesams 2013-07-11 00:23:36 -05:00
parent ba22c83861
commit 78daaeb583
2 changed files with 22 additions and 8 deletions

View File

@ -25,6 +25,7 @@
#include "zvision/script_manager.h"
#include "zvision/utility.h"
#include "zvision/puzzle.h"
#include "zvision/actions.h"
#include "common/textconsole.h"
#include "common/file.h"
@ -53,14 +54,15 @@ void ScriptManager::parseScrFile(Common::String fileName) {
sscanf(line.c_str(),"puzzle:%u",&(puzzle.key));
parsePuzzle(puzzle, file);
_puzzles.push_back(puzzle);
_activePuzzles.push_back(puzzle);
} else if (line.matchString("control:*", true)) {
Control control;
char controlType[20];
sscanf(line.c_str(),"control:%u %s",&(control.id), controlType);
parseControl(control, file);
_controls.push_back(control);
/** Holds the currently active puzzles */
_activeControls.push_back(control);
}
}
}

View File

@ -26,21 +26,33 @@
#include "common/str.h"
#include "common/stream.h"
#include "common/hashmap.h"
#include "common/stack.h"
#include "zvision/puzzle.h"
#include "zvision/control.h"
#include "zvision/actions.h"
namespace ZVision {
class ActionNode;
class ScriptManager {
private:
/** Holds the global state variables. Optimize for fast random access */
/**
* Holds the global state variable. Do NOT directly modify this. Use the accessors and
* mutators getStateValue() and setStateValue(). This ensures that Puzzles that reference a
* particular state key are checked after the key is modified.
*/
Common::HashMap<uint32, byte> _globalState;
/** Holds the currently active puzzles. Optimize for fast iteration */
Common::List<Puzzle> _puzzles;
/** Holds the currently active controls. Optimize for fast iteration */
Common::List<Control> _controls;
/** Holds the currently active ActionNodes */
Common::List<ActionNode *> _activeNodes;
/** References _globalState keys to Puzzles */
Common::HashMap<uint32, Common::Array<Puzzle *>> _referenceTable;
/** Holds the Puzzles that should be checked this frame */
Common::Stack<Puzzle *> _puzzlesToCheck;
/** Holds the currently active puzzles */
Common::List<Puzzle> _activePuzzles;
/** Holds the currently active controls */
Common::List<Control> _activeControls;
public: