aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support
diff options
context:
space:
mode:
authorPaul Gilbert2016-11-06 14:26:44 -0500
committerPaul Gilbert2016-11-06 14:26:44 -0500
commit927adb7f05e06ecc3a6303dbc2437e8b8f45dd70 (patch)
treeca341a91ab28311097b1fcdd9cb70fe10d88a6a7 /engines/titanic/support
parentd349e911b8f87438ad7ba7dd270102df60aa061f (diff)
downloadscummvm-rg350-927adb7f05e06ecc3a6303dbc2437e8b8f45dd70.tar.gz
scummvm-rg350-927adb7f05e06ecc3a6303dbc2437e8b8f45dd70.tar.bz2
scummvm-rg350-927adb7f05e06ecc3a6303dbc2437e8b8f45dd70.zip
TITANIC: Fix word wrapping in the conversation log
Diffstat (limited to 'engines/titanic/support')
-rw-r--r--engines/titanic/support/font.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp
index 2e98639ff7..f81251b10b 100644
--- a/engines/titanic/support/font.cpp
+++ b/engines/titanic/support/font.cpp
@@ -315,10 +315,10 @@ void STFont::extendBounds(Point &textSize, byte c, int maxWidth) const {
void STFont::checkLineWrap(Point &textSize, int maxWidth, const char *&str) const {
bool flag = false;
int totalWidth = 0;
- for (const char *srcPtr = str + 1; *srcPtr && *srcPtr != ' '; ++srcPtr) {
- if (*srcPtr == ' ' && flag)
- break;
+ // Loop forward getting the width of the word (including preceding space)
+ // until a space is encountered following at least one character
+ for (const char *srcPtr = str; *srcPtr && (*srcPtr != ' ' || !flag); ++srcPtr) {
if (*srcPtr == TEXTCMD_NPC) {
srcPtr += 3;
} else if (*srcPtr == TEXTCMD_SET_COLOR) {