From d1cd2f51261407fa363d28c256f7697e2dc754ad Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 29 Dec 2019 00:00:44 +0100 Subject: DIRECTOR: LINGO: Fix behaviour of global variables --- engines/director/lingo/lingo-codegen.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'engines/director/lingo') diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index 84557650fd..7d9f1577e1 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -179,7 +179,7 @@ Symbol *Lingo::lookupVar(const char *name, bool create, bool putInGlobalList) { if (!_localvars || !_localvars->contains(name)) { // Create variable if it was not defined // Check if it is a global symbol - if (_globalvars.contains(name) && _globalvars[name]->type == SYMBOL) + if (_globalvars.contains(name)) return _globalvars[name]; if (!create) @@ -190,10 +190,11 @@ Symbol *Lingo::lookupVar(const char *name, bool create, bool putInGlobalList) { sym->type = VOID; sym->u.i = 0; - if (_localvars) - (*_localvars)[name] = sym; + if (!putInGlobalList) { + if (_localvars) + (*_localvars)[name] = sym; - if (putInGlobalList) { + } else { sym->global = true; _globalvars[name] = sym; } -- cgit v1.2.3