From 8e6304bd13886a46bd9e64974bb02fc89bba03e2 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 22 Dec 2019 14:49:43 +0100 Subject: DIRECTOR: Fix implementation of converting references to strings --- engines/director/lingo/lingo.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'engines/director/lingo') 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()); -- cgit v1.2.3