Changeset - r9904:87b28570673d
[Not reviewed]
master
0 1 0
rubidium - 16 years ago 2008-08-12 19:29:10
rubidium@openttd.org
(svn r14054) -Fix (rthebeginning): long strings in the edit box would cause OpenTTD to stop drawing the string. This is especially noticable with low resolutions and the chat input box.
1 file changed with 3 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/gfx.cpp
Show inline comments
 
@@ -767,14 +767,14 @@ void DrawCharCentered(WChar c, int x, in
 
}
 

	
 
/** Draw a string at the given coordinates with the given colour.
 
 *  While drawing the string, parse it in case some formatting is specified,
 
 *  like new colour, new size or even positionning.
 
 * @param string              The string to draw
 
 * @param x                   Offset from left side of the screen, if negative offset from the right side
 
 * @param y                   Offset from top side of the screen, if negative offset from the bottom
 
 * @param x                   Offset from left side of the screen
 
 * @param y                   Offset from top side of the screen
 
 * @param real_colour         Colour of the string, see _string_colormap in
 
 *                            table/palettes.h or docs/ottd-colourtext-palette.png or the enum TextColour in gfx_type.h
 
 * @param parse_string_also_when_clipped
 
 *                            By default, always test the available space where to draw the string.
 
 *                            When in multipline drawing, it would already be done,
 
 *                            so no need to re-perform the same kind (more or less) of verifications.
 
@@ -793,17 +793,13 @@ int DoDrawString(const char *string, int
 
	byte colour = real_colour & 0xFF;  // extract the 8 bits colour index that is required for the mapping
 
	byte previous_colour = colour;
 

	
 
	if (!parse_string_also_when_clipped) {
 
		/* in "mode multiline", the available space have been verified. Not in regular one.
 
		 * So if the string cannot be drawn, return the original start to say so.*/
 
		if (x >= dpi->left + dpi->width ||
 
				x + _screen.width * 2 <= dpi->left ||
 
				y >= dpi->top + dpi->height ||
 
				y + _screen.height <= dpi->top)
 
					return x;
 
		if (x >= dpi->left + dpi->width || y >= dpi->top + dpi->height) return x;
 

	
 
		if (colour != TC_INVALID) { // the invalid colour flag test should not  really occur.  But better be safe
 
switch_colour:;
 
			if (real_colour & IS_PALETTE_COLOR) {
 
				_string_colorremap[1] = colour;
 
				_string_colorremap[2] = _use_dos_palette ? 1 : 215;
0 comments (0 inline, 0 general)