aboutsummaryrefslogtreecommitdiff
path: root/scumm/string.cpp
diff options
context:
space:
mode:
authorMax Horn2005-06-04 21:21:18 +0000
committerMax Horn2005-06-04 21:21:18 +0000
commit1e1226ccbdd082048679dd3aaadd36e8d214d907 (patch)
treee2c52bc670995c9ad2e41581563118a40e8f2ee3 /scumm/string.cpp
parentf1f7e19dfe8d2c939e3f6f397bbe7931b3edc98f (diff)
downloadscummvm-rg350-1e1226ccbdd082048679dd3aaadd36e8d214d907.tar.gz
scummvm-rg350-1e1226ccbdd082048679dd3aaadd36e8d214d907.tar.bz2
scummvm-rg350-1e1226ccbdd082048679dd3aaadd36e8d214d907.zip
Updated comment; added code to deal with newline chars in COMI text (see bug #902415)
svn-id: r18346
Diffstat (limited to 'scumm/string.cpp')
-rw-r--r--scumm/string.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/scumm/string.cpp b/scumm/string.cpp
index e7273c8306..0e0a79b5d5 100644
--- a/scumm/string.cpp
+++ b/scumm/string.cpp
@@ -886,6 +886,8 @@ void ScummEngine_v7::loadLanguageBundle() {
// tags and offsets. I did consider using a balanced tree
// instead, but the extra overhead in the node structure would
// easily have doubled the memory consumption of the index.
+ // And anyway, using qsort + bsearch gives us the exact same
+ // O(log(n)) access time anyway ;-).
_languageIndex = (LangIndexNode *)calloc(_languageIndexSize, sizeof(LangIndexNode));
@@ -958,7 +960,7 @@ void ScummEngine_v7::loadLanguageBundle() {
// After that follows a single space which we skip
assert(isspace(*ptr));
ptr++;
-
+
// Then comes the translated string: we record an offset to that.
_languageIndex[i].offset = ptr - _languageBuffer;
@@ -968,6 +970,19 @@ void ScummEngine_v7::loadLanguageBundle() {
break;
while (*ptr == '\n' || *ptr == '\r')
*ptr++ = 0;
+
+ // Convert '\n' code to a newline. See also bug #902415.
+ char *src, *dst;
+ src = dst = _languageBuffer + _languageIndex[i].offset;
+ while (*src) {
+ if (src[0] == '\\' && src[1] == 'n') {
+ *dst++ = '\n';
+ src += 2;
+ } else {
+ *dst++ = *src++;
+ }
+ }
+ *dst = 0;
}
}