[Scummvm-cvs-logs] scummvm master -> 4a204af5b71ad000ec8f2952f8343ac0328d45cd
m-kiewitz
m_kiewitz at users.sourceforge.net
Fri Feb 19 15:56:32 CET 2016
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
4a204af5b7 AGI: Fix a tiny inaccuracy in string word wrapper
Commit: 4a204af5b71ad000ec8f2952f8343ac0328d45cd
https://github.com/scummvm/scummvm/commit/4a204af5b71ad000ec8f2952f8343ac0328d45cd
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-02-19T15:56:00+01:00
Commit Message:
AGI: Fix a tiny inaccuracy in string word wrapper
Fixes one message box in Gold Rush during Stagecoach path,
that wasn't wrapped correctly.
Changed paths:
engines/agi/text.cpp
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index 7c8594b..611bd13 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -943,8 +943,9 @@ char *TextMgr::stringWordWrap(const char *originalText, int16 maxWidth, int16 *c
//memset(resultWrappedBuffer, 0, sizeof(resultWrappedBuffer)); for debugging
// Good testcases:
- // King's Quest 1 intro: the scrolling text is filled up with spaces, so that old lines are erased
- // Apple IIgs restart system UI: spaces used to make the window larger
+ // King's Quest 1 intro: the scrolling text is filled up with spaces, so that old lines are erased
+ // Apple IIgs restart system UI: spaces used to make the window larger
+ // Gold Rush Stagecoach path room 60: " Lake Michigan!", with max length 9 -> should get split into " Lake" / "Michigan!"
while (originalText[curReadPos]) {
// Try to find out length of next word
@@ -967,6 +968,15 @@ char *TextMgr::stringWordWrap(const char *originalText, int16 maxWidth, int16 *c
if (wordLen >= lineWidthLeft) {
// Not enough space left
+
+ // If first character right after the new line is a space, skip over it
+ if (wordLen) {
+ if (originalText[wordStartPos] == ' ') {
+ wordStartPos++;
+ wordLen--;
+ }
+ }
+
if (wordLen > maxWidth) {
// Word way too long, split it in half
curReadPos = curReadPos - (wordLen - maxWidth);
@@ -983,14 +993,6 @@ char *TextMgr::stringWordWrap(const char *originalText, int16 maxWidth, int16 *c
// Reached absolute maximum? -> exit now
if (boxHeight >= HEIGHT_MAX)
break;
-
- // If first character right after the new line is a space, skip over it
- if (wordLen) {
- if (originalText[wordStartPos] == ' ') {
- wordStartPos++;
- wordLen--;
- }
- }
}
// Copy current word over
More information about the Scummvm-git-logs
mailing list