Changeset - r11461:4fc553dec6e3
[Not reviewed]
master
0 1 0
rubidium - 15 years ago 2009-03-22 23:54:36
rubidium@openttd.org
(svn r15824) -Fix: determine the actual length of the strings to draw in the viewport
1 file changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/viewport.cpp
Show inline comments
 
@@ -1460,11 +1460,15 @@ static void ViewportDrawStrings(DrawPixe
 

	
 
		/* The maximum width of the string */
 
		int w = GB(ss->width, 0, 15);
 
		if (w == 0) w = UINT16_MAX;
 
		if (w == 0) {
 
			char buffer[DRAW_STRING_BUFFER];
 
			GetString(buffer, ss->string, lastof(buffer));
 
			w = GetStringBoundingBox(buffer).width;
 
		}
 

	
 
		DrawString(
 
			UnScaleByZoom(ss->x, zoom), UnScaleByZoom(ss->x, zoom) + w, UnScaleByZoom(ss->y, zoom) - (ss->width & 0x8000 ? 2 : 0),
 
			ss->string, colour
 
			ss->string, colour, SA_CENTER
 
		);
 
	}
 
}
0 comments (0 inline, 0 general)