From a7efc8afd8f4831d00eec82bfdd8b299f56f6d52 Mon Sep 17 00:00:00 2001 From: lolbot-iichan Date: Tue, 18 Jun 2019 19:52:43 +0300 Subject: WINTERMUTE: Fix Split() method of ext_string It's hard to believe, but this fixes bug "#10432" WME Carol Reed Mysteries hint system not working. Carol Reed hint system happen to heavily use line.Split(";") results, which were wrong by 1 byte (delimeter was appended to result while it shouldn't be). I started with decompiling Carol Reed source code, reproducing issue with a stand-alone test project (which worked with WME and showed [null] with ScummVM). then minimized it to a minimal testcase: var line = new String("New Goal;Visit Christina at the Art Museum;1;0;S;;"); var ar = line.Split(";"); if((ar[0] == "New Goal")) { var g = ar[1]; } --- engines/wintermute/base/scriptables/script_ext_string.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/wintermute/base') diff --git a/engines/wintermute/base/scriptables/script_ext_string.cpp b/engines/wintermute/base/scriptables/script_ext_string.cpp index bc0c658c57..3b6fbf24b9 100644 --- a/engines/wintermute/base/scriptables/script_ext_string.cpp +++ b/engines/wintermute/base/scriptables/script_ext_string.cpp @@ -303,7 +303,7 @@ bool SXString::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack uint32 ch = (i == str.size()) ? '\0' : str[i]; if (ch =='\0' || delims.contains(ch)) { if (i != start) { - parts.push_back(WideString(str.c_str() + start, i - start + 1)); + parts.push_back(WideString(str.c_str() + start, i - start)); } else { parts.push_back(WideString()); } -- cgit v1.2.3