diff options
Diffstat (limited to 'engines/director/lingo/lingo.cpp')
-rw-r--r-- | engines/director/lingo/lingo.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index 3d166acba0..e338c3d646 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -71,6 +71,8 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) { for (const EventHandlerType *t = &eventHanlerDescs[0]; t->handler != kEventNone; ++t) _eventHandlerTypes[t->handler] = t->name; + + _currentScript = 0; } Lingo::~Lingo() { @@ -78,6 +80,15 @@ Lingo::~Lingo() { void Lingo::addCode(Common::String code, ScriptType type, uint16 id) { debug(0, "Add code %s for type %d with id %d", code.c_str(), type, id); + + if (_scripts[type].contains(id)) { + free(_scripts[type][id]); + } + + _currentScript = new Common::Array<inst>(); + _scripts[type][id] = _currentScript; + + parse(code.c_str()); } void Lingo::processEvent(LEvent event, int entityId) { @@ -87,5 +98,4 @@ void Lingo::processEvent(LEvent event, int entityId) { debug(0, "processEvent(%s) for %d", _eventHandlerTypes[event], entityId); } - } // End of namespace Director |