aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo/lingo-code.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2016-06-29 07:43:38 +0200
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commit7013f6bb40d9be0b3620ab331be4d4d1b60ac477 (patch)
tree89cbb3cd1a91514bbffbeabb9bea9e42293c2fe9 /engines/director/lingo/lingo-code.cpp
parent4b871b62e5fea82517301c7377118244420723d7 (diff)
downloadscummvm-rg350-7013f6bb40d9be0b3620ab331be4d4d1b60ac477.tar.gz
scummvm-rg350-7013f6bb40d9be0b3620ab331be4d4d1b60ac477.tar.bz2
scummvm-rg350-7013f6bb40d9be0b3620ab331be4d4d1b60ac477.zip
DIRECTOR: Lingo: Implemented 'global' keyword. Start of local/global var implementation
Diffstat (limited to 'engines/director/lingo/lingo-code.cpp')
-rw-r--r--engines/director/lingo/lingo-code.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 92cb9940e0..349b51f1ca 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -424,4 +424,24 @@ void Lingo::c_procret() {
g_lingo->_returning = true;
}
+void Lingo::c_global() {
+ Common::String name((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
+
+ Symbol *s = g_lingo->lookupVar(name.c_str(), false);
+ if (s) {
+ if (s->global) {
+ warning("Redefinition of global variable %s", name.c_str());
+ } else {
+ warning("Local variable %s declared as global", name.c_str());
+ }
+
+ return;
+ }
+
+ s = g_lingo->lookupVar(name.c_str(), true, false);
+ s->global = true;
+
+ g_lingo->_pc += g_lingo->calcStringAlignment(name.c_str());
+}
+
}