aboutsummaryrefslogtreecommitdiff
path: root/kyra/font.cpp
diff options
context:
space:
mode:
authorMax Horn2004-10-30 18:02:48 +0000
committerMax Horn2004-10-30 18:02:48 +0000
commit40d9601b615993763252abeea13621a0a629bd88 (patch)
tree23f748040863259583ae72662a75c09281d6fd9f /kyra/font.cpp
parent94d74a04e98828603bdcfc7f8cfaa76e2349a947 (diff)
downloadscummvm-rg350-40d9601b615993763252abeea13621a0a629bd88.tar.gz
scummvm-rg350-40d9601b615993763252abeea13621a0a629bd88.tar.bz2
scummvm-rg350-40d9601b615993763252abeea13621a0a629bd88.zip
Fix by salty-horse: "currently, it doesn't handle the last word in a sentence
properly. the width comes out garbage, and then it is sometimes moved to the next line for no reason svn-id: r15698
Diffstat (limited to 'kyra/font.cpp')
-rw-r--r--kyra/font.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/kyra/font.cpp b/kyra/font.cpp
index c802fcb2e3..01428f1442 100644
--- a/kyra/font.cpp
+++ b/kyra/font.cpp
@@ -84,8 +84,8 @@ namespace Kyra {
uint32 Font::getStringWidth(const char* string, char terminator) {
uint32 strsize;
- for (strsize = 0; string[strsize] != terminator; ++strsize)
- ;
+ for (strsize = 0; string[strsize] != terminator && string[strsize] != '\0'; ++strsize)
+ ;
uint32 stringwidth = 0;
@@ -113,11 +113,11 @@ namespace Kyra {
// gets start of the word
for (; string[startpos] == ' '; ++startpos)
- ;
+ ;
// not counting size
for (*size = 0; string[startpos + *size] != ' ' && string[startpos + *size] != '\0'; ++(*size))
- ;
+ ;
++(*size);