Skip to content
Browse files

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
var ar = line.Split(";");
if((ar[0] == "New Goal")) { var g = ar[1]; }
  • Loading branch information...
lolbot-iichan authored and bluegr committed Jun 18, 2019
1 parent bbed50f commit a7efc8afd8f4831d00eec82bfdd8b299f56f6d52
Showing with 1 addition and 1 deletion.
  1. +1 −1 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 {

0 comments on commit a7efc8a

Please sign in to comment.
You can’t perform that action at this time.