aboutsummaryrefslogtreecommitdiff
path: root/engines/lure/surface.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2007-12-19 01:47:45 +0000
committerPaul Gilbert2007-12-19 01:47:45 +0000
commitb4043cb4035677319c3e3455e7724896d9f32250 (patch)
tree92d8c78ff9db58ef86fb020746501829a695ed5d /engines/lure/surface.cpp
parent62a344bbed1ca00bc57ffe6e6878100c99ca60ff (diff)
downloadscummvm-rg350-b4043cb4035677319c3e3455e7724896d9f32250.tar.gz
scummvm-rg350-b4043cb4035677319c3e3455e7724896d9f32250.tar.bz2
scummvm-rg350-b4043cb4035677319c3e3455e7724896d9f32250.zip
Bugfix for correctly handling \n characters in WordWrap method
svn-id: r29903
Diffstat (limited to 'engines/lure/surface.cpp')
-rw-r--r--engines/lure/surface.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp
index 05da32c2bb..5cdd338ab1 100644
--- a/engines/lure/surface.cpp
+++ b/engines/lure/surface.cpp
@@ -352,13 +352,13 @@ void Surface::wordWrap(char *text, uint16 width, char **&lines, uint8 &numLines)
(uint32)(wordStart - text), (uint32)((wordEnd == NULL) ? -1 : wordEnd - text), newLine ? 1 : 0);
if (wordEnd) {
- if (!newLine) --wordEnd;
+ if (*wordEnd != '\0') --wordEnd;
} else {
wordEnd = strchr(wordStart, '\0') - 1;
}
int wordBytes = (int) (wordEnd - s + 1);
- uint16 wordSize = textWidth(s, wordBytes);
+ uint16 wordSize = (wordBytes == 0) ? 0 : textWidth(s, wordBytes);
if (gDebugLevel >= ERROR_DETAILED) {
char wordBuffer[MAX_DESC_SIZE];
strncpy(wordBuffer, wordStart, wordBytes);
@@ -375,7 +375,7 @@ void Surface::wordWrap(char *text, uint16 width, char **&lines, uint8 &numLines)
} else if (newLine) {
// Break on newline
++numLines;
- *wordEnd = '\0';
+ *++wordEnd = '\0';
lineWidth = 0;
} else {
// Add word's length to total for line