aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo
diff options
context:
space:
mode:
Diffstat (limited to 'engines/director/lingo')
-rw-r--r--engines/director/lingo/lingo.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index cf6bd69016..d4529d17ca 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -615,7 +615,21 @@ Common::String *Datum::toString() {
*s = Common::String::format("var: #%s", u.sym->name.c_str());
break;
case REFERENCE:
- *s = Common::String::format("field#%d", u.i);
+ {
+ int idx = u.i;
+
+ if (!g_director->getCurrentScore()->_loadedText->contains(idx)) {
+ if (!g_director->getCurrentScore()->_loadedText->contains(idx - 1024)) {
+ warning("toString(): Unknown REFERENCE %d", idx);
+ *s = "";
+ break;
+ } else {
+ idx -= 1024;
+ }
+ }
+
+ *s = g_director->getCurrentScore()->_loadedText->getVal(idx)->_ptext;
+ }
break;
default:
warning("Incorrect operation toString() for type: %s", type2str());