aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorrichiesams2013-07-11 00:23:36 -0500
committerrichiesams2013-08-04 13:32:13 -0500
commit78daaeb583a371edddd67b5399cbc14201fe7ee1 (patch)
tree1b5e4ed3eebb32fad5539705b54ef78c8c375bce /engines
parentba22c838613912238196d8488a9f781f07416c77 (diff)
downloadscummvm-rg350-78daaeb583a371edddd67b5399cbc14201fe7ee1.tar.gz
scummvm-rg350-78daaeb583a371edddd67b5399cbc14201fe7ee1.tar.bz2
scummvm-rg350-78daaeb583a371edddd67b5399cbc14201fe7ee1.zip
ZVISION: Create main containers in ScriptManager
Diffstat (limited to 'engines')
-rw-r--r--engines/zvision/scr_file_handling.cpp6
-rw-r--r--engines/zvision/script_manager.h24
2 files changed, 22 insertions, 8 deletions
diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp
index 6bf73733e5..2371c350f7 100644
--- a/engines/zvision/scr_file_handling.cpp
+++ b/engines/zvision/scr_file_handling.cpp
@@ -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);
}
}
}
diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h
index f02073b4c6..5be4c171e0 100644
--- a/engines/zvision/script_manager.h
+++ b/engines/zvision/script_manager.h
@@ -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: