From 3aa660f4c7a4c427c895e6f45a0cf0021dd02d26 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 8 Feb 2017 18:21:46 +0100 Subject: DIRECTOR: Lingo: Fix macro definition --- engines/director/lingo/lingo-codegen.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index dccb95e0c1..65f2b2d11a 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -196,8 +196,7 @@ void Lingo::cleanLocalVars() { for (SymbolHash::const_iterator h = _localvars->begin(); h != _localvars->end(); ++h) { if (!h->_value->global) { - Symbol *sym = h->_value; - delete sym; + delete h->_value; } } @@ -219,7 +218,11 @@ void Lingo::define(Common::String &name, int start, int nargs, Common::String *p sym->name = name; sym->type = HANDLER; - _handlers[ENTITY_INDEX(_eventHandlerTypeIds[name.c_str()], _currentEntityId)] = sym; + if (!_eventHandlerTypeIds.contains(name)) { + _builtins[name] = sym; + } else { + _handlers[ENTITY_INDEX(_eventHandlerTypeIds[name.c_str()], _currentEntityId)] = sym; + } } else { //we don't want to be here. The getHandler call should have used the EntityId and the result //should have been unique! -- cgit v1.2.3