aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2007-12-18 08:05:19 +0000
committerPaul Gilbert2007-12-18 08:05:19 +0000
commit550aea90ff5a5c73c231c69a6f478522c61e374a (patch)
tree8528211db9d3fcaabdeaccae63bbfef7977312d1
parent86ee7a94af9bbd63bde36a985c49a327c1335d3a (diff)
downloadscummvm-rg350-550aea90ff5a5c73c231c69a6f478522c61e374a.tar.gz
scummvm-rg350-550aea90ff5a5c73c231c69a6f478522c61e374a.tar.bz2
scummvm-rg350-550aea90ff5a5c73c231c69a6f478522c61e374a.zip
Bugfix for font sizes indexing - dereferencing a character > 128 was giving a negative index
svn-id: r29900
-rw-r--r--engines/lure/surface.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp
index ad574205d8..05da32c2bb 100644
--- a/engines/lure/surface.cpp
+++ b/engines/lure/surface.cpp
@@ -316,7 +316,12 @@ uint16 Surface::textWidth(const char *s, int numChars) {
uint16 result = 0;
if (numChars == 0) numChars = strlen(s);
- while (numChars-- > 0) result += fontSize[*s++ - ' '] + 2;
+ while (numChars-- > 0) {
+ uint8 charIndex = (uint8)*s++ - 32;
+ assert(charIndex < numFontChars);
+ result += fontSize[charIndex] + 2;
+ }
+
return result;
}