diff options
Diffstat (limited to 'engines/director/lingo/lingo-code.cpp')
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index 36f284e71b..918dea1a56 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -121,7 +121,16 @@ void Lingo::c_varpush() { Datum d; d.u.sym = g_lingo->lookupVar(name); - d.type = VAR; + if (d.u.sym->type == CASTREF) { + d.type = INT; + int val = d.u.sym->u.val; + + delete d.u.sym; + + d.u.i = val; + } else { + d.type = VAR; + } g_lingo->_pc += g_lingo->calcStringAlignment(name); @@ -166,6 +175,11 @@ void Lingo::c_eval() { Datum d; d = g_lingo->pop(); + if (d.type != VAR) { // It could be cast ref + g_lingo->push(d); + return; + } + if (!g_lingo->verify(d.u.sym)) return; @@ -354,6 +368,10 @@ void Lingo::c_repeatwithcode(void) { Common::String countername((char *)&(*g_lingo->_currentScript)[savepc + 5]); Symbol *counter = g_lingo->lookupVar(countername.c_str()); + if (counter->type == CASTREF) { + error("Cast ref used as index: %s", countername.c_str()); + } + g_lingo->execute(init); /* condition */ d = g_lingo->pop(); d.toInt(); |