Changeset - r7535:b69be69d3c06
[Not reviewed]
master
0 1 0
rubidium - 17 years ago 2007-09-07 21:15:32
rubidium@openttd.org
(svn r11055) -Fix [FS#1214]: loading indicators would sometimes glitch due to a bounding box that was too small. Patch by frosch.
1 file changed with 10 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/texteff.cpp
Show inline comments
 
@@ -256,12 +256,13 @@ void DrawChatMessage()
 
	_chatmessage_dirty = false;
 
}
 

	
 
/** Text Effects */
 
static void MarkTextEffectAreaDirty(TextEffect *te)
 
{
 
	/* Width and height of the text effect are doubled, so they are correct in both zoom out levels 1x and 2x. */
 
	MarkAllViewportsDirty(
 
		te->x,
 
		te->y - 1,
 
		(te->right - te->x)*2 + te->x + 1,
 
		(te->bottom - (te->y - 1)) * 2 + (te->y - 1) + 1
 
	);
 
@@ -318,12 +319,21 @@ void UpdateTextEffect(TextEffectID te_id
 
	/* Update details */
 
	te = &_text_effect_list[te_id];
 
	te->string_id = msg;
 
	te->params_1 = GetDParam(0);
 
	te->params_2 = GetDParam(4);
 

	
 
	/* Update width of text effect */
 
	char buffer[100];
 
	GetString(buffer, msg, lastof(buffer));
 
	int w = GetStringBoundingBox(buffer).width;
 

	
 
	/* Only allow to make it broader, so it completely covers the old text. That avoids remnants of the old text. */
 
	int right_new = te->x + w;
 
	if (te->right < right_new) te->right = right_new;
 

	
 
	MarkTextEffectAreaDirty(te);
 
}
 

	
 
void RemoveTextEffect(TextEffectID te_id)
 
{
 
	assert(te_id < _num_text_effects);
0 comments (0 inline, 0 general)