[Scummvm-cvs-logs] scummvm master -> b1055a3c86028d517d54fbae0bef9c500facf8c7

bluegr md5 at scummvm.org
Wed Mar 2 19:40:01 CET 2011


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:
b1055a3c86 SCI: Fixed bug #3040161 - "LONGBOW: Textbox glitch"


Commit: b1055a3c86028d517d54fbae0bef9c500facf8c7
    https://github.com/scummvm/scummvm/commit/b1055a3c86028d517d54fbae0bef9c500facf8c7
Author: md5 (md5 at scummvm.org)
Date: 2011-03-02T10:38:21-08:00

Commit Message:
SCI: Fixed bug #3040161 - "LONGBOW: Textbox glitch"

GetLongest() could exceed the maximum width with the very last
character of a word. The same fix has been applied to the SCI32 code.

Changed paths:
    engines/sci/graphics/frameout.cpp
    engines/sci/graphics/text16.cpp



diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 87acfde..fbfd140 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -337,6 +337,8 @@ static int16 GetLongest(const char *text, int16 maxWidth, GfxFont *font) {
 			maxChars = curCharCount; // return count up to (but not including) breaking space
 			break;
 		}
+		if (width + font->getCharWidth(curChar) > maxWidth)
+			break;
 		width += font->getCharWidth(curChar);
 		curCharCount++;
 	}
diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp
index 21605cc..d7a9204 100644
--- a/engines/sci/graphics/text16.cpp
+++ b/engines/sci/graphics/text16.cpp
@@ -204,6 +204,8 @@ int16 GfxText16::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgF
 			maxChars = curCharCount; // return count up to (but not including) breaking space
 			break;
 		}
+		if (width + _font->getCharWidth(curChar) > maxWidth)
+			break;
 		width += _font->getCharWidth(curChar);
 		curCharCount++;
 	}






More information about the Scummvm-git-logs mailing list