aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlolbot-iichan2019-06-18 19:52:43 +0300
committerFilippos Karapetis2019-06-18 21:20:33 +0300
commita7efc8afd8f4831d00eec82bfdd8b299f56f6d52 (patch)
tree1828fa1c724e23f1e342a5b872878f0410d04c52
parentbbed50ff27a1d4c656a8876f277fe1d8dcfb5f3f (diff)
downloadscummvm-rg350-a7efc8afd8f4831d00eec82bfdd8b299f56f6d52.tar.gz
scummvm-rg350-a7efc8afd8f4831d00eec82bfdd8b299f56f6d52.tar.bz2
scummvm-rg350-a7efc8afd8f4831d00eec82bfdd8b299f56f6d52.zip
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]; }
-rw-r--r--engines/wintermute/base/scriptables/script_ext_string.cpp2
1 files changed, 1 insertions, 1 deletions
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());
}