aboutsummaryrefslogtreecommitdiff
path: root/scumm/string.cpp
diff options
context:
space:
mode:
authorPaweł Kołodziejski2002-09-18 18:48:54 +0000
committerPaweł Kołodziejski2002-09-18 18:48:54 +0000
commitb22489cf97066dfa5c93c47fe42510861b0ce02b (patch)
treed3013057cb23815942b03b8b34eb7ee5e7c7da14 /scumm/string.cpp
parent953f7112e3a3703a4f9b6abd50250493c125baff (diff)
downloadscummvm-rg350-b22489cf97066dfa5c93c47fe42510861b0ce02b.tar.gz
scummvm-rg350-b22489cf97066dfa5c93c47fe42510861b0ce02b.tar.bz2
scummvm-rg350-b22489cf97066dfa5c93c47fe42510861b0ce02b.zip
fixed for and added comments
svn-id: r4967
Diffstat (limited to 'scumm/string.cpp')
-rw-r--r--scumm/string.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/scumm/string.cpp b/scumm/string.cpp
index c80a216e2e..a6eb2bcbf2 100644
--- a/scumm/string.cpp
+++ b/scumm/string.cpp
@@ -1103,7 +1103,7 @@ void Scumm::translateText(char * text, char * trans_buff) {
char enc;
// copy name from text /..../
- for (l = 0; l < 20, *(text + l + 1) != '.'; l++) {
+ for (l = 0; (l < 20) && (*(text + l + 1) != '.'); l++) {
name[l] = *(text + l + 1);
}
name[l] = 0;
@@ -1140,7 +1140,7 @@ void Scumm::translateText(char * text, char * trans_buff) {
pos += 2;
// compare 'name' with above name
if (strcmp(tmp, name) == 0) {
- // get number lines of 'name'
+ // get number lines of 'name' after '#'
l = 0;
if (*(buf + pos++) == '#') {
do {
@@ -1156,15 +1156,18 @@ void Scumm::translateText(char * text, char * trans_buff) {
tmp2[j++] = *(buf + pos++);
} while(*(buf + pos) != '/');
tmp2[j] = 0;
+ // compare if is right line
if (strcmp(tmp2, num_s) == 0) {
k = 0;
pos++;
+ // copy translated text to tran_buffer
do {
*(trans_buff + k++) = (*(buf + pos++)) ^ enc;
} while((*(buf + pos) != 0x0d) && (*(buf + pos + 1) != 0x0a));
*(trans_buff + k) = 0;
return;
}
+ // goto next line
do {
pos++;
} while((*(buf + pos) != 0x0d) && (*(buf + pos + 1) != 0x0a));