aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo
diff options
context:
space:
mode:
authorEugene Sandulenko2019-12-29 00:00:44 +0100
committerEugene Sandulenko2019-12-29 00:51:16 +0100
commitd1cd2f51261407fa363d28c256f7697e2dc754ad (patch)
tree55b5b411b659f7ce8db3510e7ff59dfc81c65f6b /engines/director/lingo
parentecaebf7cedba882185c1b87f12a01bc84d91f879 (diff)
downloadscummvm-rg350-d1cd2f51261407fa363d28c256f7697e2dc754ad.tar.gz
scummvm-rg350-d1cd2f51261407fa363d28c256f7697e2dc754ad.tar.bz2
scummvm-rg350-d1cd2f51261407fa363d28c256f7697e2dc754ad.zip
DIRECTOR: LINGO: Fix behaviour of global variables
Diffstat (limited to 'engines/director/lingo')
-rw-r--r--engines/director/lingo/lingo-codegen.cpp9
1 files changed, 5 insertions, 4 deletions
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;
}