aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
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: