Skip to content

Commit

Permalink
ACCESS: Fix getLine when \r occurs just after maximum line width reached
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 31, 2014
1 parent b5b298a commit f8778a5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion engines/access/font.cpp
Expand Up @@ -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;
}

Expand All @@ -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;
}
Expand Down

0 comments on commit f8778a5

Please sign in to comment.