diff options
author | Einar Johan Trøan Sømåen | 2012-06-14 02:18:47 +0200 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-06-14 02:18:47 +0200 |
commit | 7f19595d911cd017439cc6a3e87f04698c8bbacc (patch) | |
tree | 0da80fbdb0e1a2bfedf0530e24b25a2f02837b99 /engines/wintermute | |
parent | c1046889411d4f38babd21b1b38c0cbd457caf10 (diff) | |
download | scummvm-rg350-7f19595d911cd017439cc6a3e87f04698c8bbacc.tar.gz scummvm-rg350-7f19595d911cd017439cc6a3e87f04698c8bbacc.tar.bz2 scummvm-rg350-7f19595d911cd017439cc6a3e87f04698c8bbacc.zip |
WINTERMUTE: Fix SXString's - "Split"
Diffstat (limited to 'engines/wintermute')
-rw-r--r-- | engines/wintermute/Base/scriptables/SXString.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/engines/wintermute/Base/scriptables/SXString.cpp b/engines/wintermute/Base/scriptables/SXString.cpp index 4a1936da58..50799d6d4a 100644 --- a/engines/wintermute/Base/scriptables/SXString.cpp +++ b/engines/wintermute/Base/scriptables/SXString.cpp @@ -33,6 +33,7 @@ #include "engines/wintermute/Base/scriptables/SXString.h"
#include "engines/wintermute/Base/scriptables/SXArray.h"
#include "engines/wintermute/utils/StringUtil.h"
+#include "common/tokenizer.h"
namespace WinterMute {
@@ -268,7 +269,14 @@ HRESULT CSXString::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th size_t start, pos;
start = 0;
- do {
+
+ Common::StringTokenizer tokenizer(str, delims);
+ while (!tokenizer.empty()) {
+ Common::String str2 = tokenizer.nextToken();
+ parts.push_back(str2);
+ }
+ // TODO: Clean this up
+ /*do {
pos = StringUtil::IndexOf(Common::String(str.c_str() + start), delims, start);
//pos = str.find_first_of(delims, start);
if (pos == start) {
@@ -283,7 +291,7 @@ HRESULT CSXString::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th //start = str.find_first_not_of(delims, start);
start = StringUtil::LastIndexOf(Common::String(str.c_str() + start), delims, start) + 1;
- } while (pos != str.size());
+ } while (pos != str.size());*/
for (Common::Array<WideString>::iterator it = parts.begin(); it != parts.end(); ++it) {
WideString &part = (*it);
@@ -294,7 +302,7 @@ HRESULT CSXString::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th Val = new CScValue(Game, StringUtil::WideToAnsi(part).c_str());
Array->Push(Val);
- delete[] Val;
+ delete Val;
Val = NULL;
}
|