Changeset - r15391:0116c81813cc
[Not reviewed]
master
0 1 0
alberth - 14 years ago 2010-07-02 13:54:05
alberth@openttd.org
(svn r20044) -Codechange: Using number of lines rather than number of added lines simplifies code.
1 file changed with 5 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/gfx.cpp
Show inline comments
 
@@ -842,17 +842,17 @@ int DrawStringMultiLine(int left, int ri
 
	GetString(buffer, str, lastof(buffer));
 

	
 
	uint32 tmp = FormatStringLinebreaks(buffer, lastof(buffer), maxw);
 
	int num = GB(tmp, 0, 16);
 
	int num = GB(tmp, 0, 16) + 1;
 

	
 
	int mt = GetCharacterHeight((FontSize)GB(tmp, 16, 16));
 
	int total_height = (num + 1) * mt;
 
	int total_height = num * mt;
 

	
 
	if (total_height > maxh) {
 
		/* Check there's room enough for at least one line. */
 
		if (maxh < mt) return top;
 

	
 
		num = maxh / mt - 1;
 
		total_height = (num + 1) * mt;
 
		num = maxh / mt;
 
		total_height = num * mt;
 
	}
 

	
 
	int y = ((align & SA_VERT_MASK) == SA_VERT_CENTER) ? RoundDivSU(bottom + top - total_height, 2) : top;
 
@@ -869,7 +869,7 @@ int DrawStringMultiLine(int left, int ri
 
			WChar c = Utf8Consume(&src);
 
			if (c == 0) {
 
				y += mt;
 
				if (--num < 0) {
 
				if (--num <= 0) {
 
					return y;
 
				}
 
				break;
0 comments (0 inline, 0 general)