aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2019-12-22 14:49:43 +0100
committerEugene Sandulenko2019-12-22 14:49:43 +0100
commit8e6304bd13886a46bd9e64974bb02fc89bba03e2 (patch)
treea4c4e7d0707f00ab421a2cb1117c3a3c3b33de5b /engines
parent8895ca3c1fc5957da7d47f73788ed6d223dcfac6 (diff)
downloadscummvm-rg350-8e6304bd13886a46bd9e64974bb02fc89bba03e2.tar.gz
scummvm-rg350-8e6304bd13886a46bd9e64974bb02fc89bba03e2.tar.bz2
scummvm-rg350-8e6304bd13886a46bd9e64974bb02fc89bba03e2.zip
DIRECTOR: Fix implementation of converting references to strings
Diffstat (limited to 'engines')
-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());