From 2e0078ef0640dc237b0681e03f06824bffd9be10 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 15 Jul 2016 19:31:18 +0300 Subject: [PATCH] DIRECTOR: Lingo: Fix line counting in code chunks --- engines/director/lingo/lingo.cpp | 4 +++- engines/director/lingo/tests/factory.lingo | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index 8302c5996edb..2c2583699eee 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -163,7 +163,7 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) { begin = code; first = false; } - Common::String chunk(begin, end - 1); + Common::String chunk(begin, end); if (chunk.hasPrefix("factory") || chunk.hasPrefix("method")) _inFactory = true; @@ -182,6 +182,8 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) { } _hadError = true; // HACK: This is for preventing test execution + + debug(2, "Code chunk:\n#####\n%s#####", begin); parse(begin); } else { parse(code); diff --git a/engines/director/lingo/tests/factory.lingo b/engines/director/lingo/tests/factory.lingo index 048bb606a134..cf1e14208863 100644 --- a/engines/director/lingo/tests/factory.lingo +++ b/engines/director/lingo/tests/factory.lingo @@ -26,7 +26,7 @@ method mExit method mDispose global aim1 set aim1 = 1 - when keydown then nothing +-- when keydown then nothing -- factory fire2 method mNew @@ -41,8 +41,8 @@ method mAtFrame set the castnum of sprite 14 to f16 set the perframehook to false me(hit) --- exit - end if + exit +-- end if if startV < targetV or bcast>g17 then set the perframehook to false set the locV of sprite 14 to 340