diff options
author | Torbjörn Andersson | 2006-04-19 14:18:34 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2006-04-19 14:18:34 +0000 |
commit | 41afb2a9962aafb2cfd91a89f057ad14c8cb4c4f (patch) | |
tree | 8592c50d43e936580ed08aaf8b9a7f591cd54230 /engines/simon | |
parent | 18d0afaafd3f37c0013353d642baedf9141f7d38 (diff) | |
download | scummvm-rg350-41afb2a9962aafb2cfd91a89f057ad14c8cb4c4f.tar.gz scummvm-rg350-41afb2a9962aafb2cfd91a89f057ad14c8cb4c4f.tar.bz2 scummvm-rg350-41afb2a9962aafb2cfd91a89f057ad14c8cb4c4f.zip |
Fixed a potential bug when calculating the width of conversation option in FF.
This bug appears to have been present in the original as well, though the
chances of triggering it are small. (We did in at least one place, before
adding the number prefix to the string.)
svn-id: r22036
Diffstat (limited to 'engines/simon')
-rw-r--r-- | engines/simon/string.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/engines/simon/string.cpp b/engines/simon/string.cpp index 7c962637d5..cffebd0c67 100644 --- a/engines/simon/string.cpp +++ b/engines/simon/string.cpp @@ -129,13 +129,17 @@ void SimonEngine::printInteractText(uint16 num, const char *string) { char *convertedString2 = convertedString; const char *string2 = string; uint16 height = 15; - uint16 w = 620; + uint16 w = 0xFFFF; uint16 b, pixels, x; + // It doesn't really matter what 'w' is to begin with, as long as it's + // something that cannot be generated by getPixelLength(). The original + // used 620, which was a potential problem. + while (1) { string2 = getPixelLength(string, 620, pixels); if (*string2 == 0x00) { - if (w == 620) + if (w == 0xFFFF) w = pixels; strcpy(convertedString2, string); break; @@ -145,7 +149,7 @@ void SimonEngine::printInteractText(uint16 num, const char *string) { pixels -= charWidth[chr]; string2--; } - if (w == 620) + if (w == 0xFFFF) w = pixels; b = string2 - string; strncpy(convertedString2, string, b); |