Skip to content

Commit

Permalink
ZVISION: New class for handle values and values from [slots].
Browse files Browse the repository at this point in the history
  • Loading branch information
Marisa-Chan committed Oct 30, 2013
1 parent a8feff1 commit e38ca6e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
23 changes: 23 additions & 0 deletions engines/zvision/script_manager.cpp
Expand Up @@ -515,4 +515,27 @@ Location ScriptManager::getCurrentLocation() const {
return location;
}

ValueSlot::ValueSlot(ScriptManager *sc_man, const char *slot_val):
_sc_man(sc_man) {
value = 0;
slot = false;
const char *is_slot = strstr(slot_val, "[");
if (is_slot) {
slot = true;
value = atoi(is_slot + 1);
} else {
slot = false;
value = atoi(slot_val);
}
}
int16 ValueSlot::getValue() {
if (slot) {
if (value >= 0)
return _sc_man->getStateValue(value);
else
return 0;
} else
return value;
}

} // End of namespace ZVision
10 changes: 10 additions & 0 deletions engines/zvision/script_manager.h
Expand Up @@ -304,6 +304,16 @@ class ScriptManager {
Control *parseControl(Common::String &line, Common::SeekableReadStream &stream);
};

class ValueSlot {
public:
ValueSlot(ScriptManager *sc_man, const char *slot_val);
int16 getValue();
private:
int16 value;
bool slot;
ScriptManager *_sc_man;
};


} // End of namespace ZVision

Expand Down

0 comments on commit e38ca6e

Please sign in to comment.