aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2014-08-30 21:43:24 -0400
committerPaul Gilbert2014-08-30 21:43:24 -0400
commitf8778a5e04b5cc46a898d9d6c570f506e7d3b58c (patch)
tree0e9c71b64559cdc5b53666bcb0f8963db81219ca /engines
parentb5b298a5d5a6cf461d14c6f48bdd301df803da62 (diff)
downloadscummvm-rg350-f8778a5e04b5cc46a898d9d6c570f506e7d3b58c.tar.gz
scummvm-rg350-f8778a5e04b5cc46a898d9d6c570f506e7d3b58c.tar.bz2
scummvm-rg350-f8778a5e04b5cc46a898d9d6c570f506e7d3b58c.zip
ACCESS: Fix getLine when \r occurs just after maximum line width reached
Diffstat (limited to 'engines')
-rw-r--r--engines/access/font.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/access/font.cpp b/engines/access/font.cpp
index 75add4129c..ffc1715c39 100644
--- a/engines/access/font.cpp
+++ b/engines/access/font.cpp
@@ -74,6 +74,9 @@ void Font::load(const int *fontIndex, const byte *fontData) {
}
int Font::charWidth(char c) {
+ if (c < ' ')
+ return 0;
+
return _chars[c - ' '].w;
}
@@ -95,7 +98,7 @@ bool Font::getLine(Common::String &s, int maxWidth, Common::String &line, int &w
while ((c = *src) != '\0') {
if (c == '\r') {
// End of line, so return calculated line
- line = Common::String(s.c_str(), src - 1);
+ line = Common::String(s.c_str(), src);
s = Common::String(src + 1);
return false;
}