Skip to content

Commit

Permalink
ZVISION: Added global StateFlags and set/get/unset functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marisa-Chan committed Oct 25, 2013
1 parent 91cbb1e commit 8e4070c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
24 changes: 24 additions & 0 deletions engines/zvision/script_manager.cpp
Expand Up @@ -253,6 +253,30 @@ void ScriptManager::setStateValue(uint32 key, uint value) {
queuePuzzles(key);
}

uint ScriptManager::getStateFlag(uint32 key) {
if (_globalStateFlags.contains(key))
return _globalStateFlags[key];
else
return 0;
}

void ScriptManager::setStateFlag(uint32 key, uint value) {
queuePuzzles(key);

_globalStateFlags[key] |= value;
}

void ScriptManager::unsetStateFlag(uint32 key, uint value) {
queuePuzzles(key);

if (_globalStateFlags.contains(key)) {
_globalStateFlags[key] &= ~value;

if (_globalStateFlags[key] == 0)
_globalStateFlags.erase(key);
}
}

void ScriptManager::addToStateValue(uint32 key, uint valueToAdd) {
_globalState[key] += valueToAdd;
}
Expand Down
6 changes: 6 additions & 0 deletions engines/zvision/script_manager.h
Expand Up @@ -143,6 +143,8 @@ class ScriptManager {
* particular state key are checked after the key is modified.
*/
StateMap _globalState;
/** Holds execute flags */
StateMap _globalStateFlags;
/** References _globalState keys to Puzzles */
PuzzleMap _referenceTable;
/** Holds the Puzzles that should be checked this frame */
Expand All @@ -169,6 +171,10 @@ class ScriptManager {
void setStateValue(uint32 key, uint value);
void addToStateValue(uint32 key, uint valueToAdd);

uint getStateFlag(uint32 key);
void setStateFlag(uint32 key, uint value);
void unsetStateFlag(uint32 key, uint value);

void addControl(Control *control);
Control *getControl(uint32 key);

Expand Down

0 comments on commit 8e4070c

Please sign in to comment.