diff options
-rw-r--r-- | engines/zvision/actions.cpp | 12 | ||||
-rw-r--r-- | engines/zvision/actions.h | 3 |
2 files changed, 12 insertions, 3 deletions
diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp index 3dd6382060..4fe288d228 100644 --- a/engines/zvision/actions.cpp +++ b/engines/zvision/actions.cpp @@ -61,11 +61,19 @@ bool ActionAdd::execute() { ActionAssign::ActionAssign(ZVision *engine, const Common::String &line) : ResultAction(engine) { - sscanf(line.c_str(), "%*[^(](%u, %u)", &_key, &_value); + char buf[64]; + memset(buf, 0, 64); + sscanf(line.c_str(), "%*[^(](%u, %s)", &_key, buf); + _value = new ValueSlot(_engine->getScriptManager(), buf); +} + +ActionAssign::~ActionAssign() { + if (_value) + delete _value; } bool ActionAssign::execute() { - _engine->getScriptManager()->setStateValue(_key, _value); + _engine->getScriptManager()->setStateValue(_key, _value->getValue()); return true; } diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h index 7464d83b09..1d7a815819 100644 --- a/engines/zvision/actions.h +++ b/engines/zvision/actions.h @@ -100,11 +100,12 @@ private: class ActionAssign : public ResultAction { public: ActionAssign(ZVision *engine, const Common::String &line); + ~ActionAssign(); bool execute(); private: uint32 _key; - uint _value; + ValueSlot *_value; }; class ActionAttenuate : public ResultAction { |