Changeset - r16002:fb7781d190f7
[Not reviewed]
master
0 2 0
yexo - 14 years ago 2010-08-31 12:18:28
yexo@openttd.org
(svn r20705) -Fix: graphic glitch when switching to a different-sized font while the chat message box was visible
2 files changed with 13 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/network/network_chat_gui.cpp
Show inline comments
 
@@ -109,22 +109,28 @@ void CDECL NetworkAddChatMessage(TextCol
 
		bufp += strlen(bufp) + 1; // jump to 'next line' in the formatted string
 
	}
 

	
 
	_chatmessage_dirty = true;
 
}
 

	
 
/** Initialize all font-dependent chat box sizes. */
 
void NetworkReInitChatBoxSize()
 
{
 
	_chatmsg_box.y       = 3 * FONT_HEIGHT_NORMAL;
 
	_chatmsg_box.height  = MAX_CHAT_MESSAGES * (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING) + 2;
 
	_chatmessage_backup  = ReallocT(_chatmessage_backup, _chatmsg_box.width * _chatmsg_box.height * BlitterFactoryBase::GetCurrentBlitter()->GetBytesPerPixel());
 
}
 

	
 
void NetworkInitChatMessage()
 
{
 
	MAX_CHAT_MESSAGES    = _settings_client.gui.network_chat_box_height;
 

	
 
	_chatmsg_list        = ReallocT(_chatmsg_list, _settings_client.gui.network_chat_box_height);
 
	_chatmsg_box.x       = 10;
 
	_chatmsg_box.y       = 3 * FONT_HEIGHT_NORMAL;
 
	_chatmsg_box.width   = _settings_client.gui.network_chat_box_width;
 
	_chatmsg_box.height  = _settings_client.gui.network_chat_box_height * (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING) + 2;
 
	_chatmessage_backup  = ReallocT(_chatmessage_backup, _chatmsg_box.width * _chatmsg_box.height * BlitterFactoryBase::GetCurrentBlitter()->GetBytesPerPixel());
 
	NetworkReInitChatBoxSize();
 
	_chatmessage_visible = false;
 

	
 
	for (uint i = 0; i < MAX_CHAT_MESSAGES; i++) {
 
		_chatmsg_list[i].message[0] = '\0';
 
	}
 
}
src/window.cpp
Show inline comments
 
@@ -2616,12 +2616,16 @@ void ReInitAllWindows()
 
	NWidgetLeaf::InvalidateDimensionCache(); // Reset cached sizes of several widgets.
 

	
 
	Window *w;
 
	FOR_ALL_WINDOWS_FROM_BACK(w) {
 
		w->ReInit();
 
	}
 
#ifdef ENABLE_NETWORK
 
	void NetworkReInitChatBoxSize();
 
	NetworkReInitChatBoxSize();
 
#endif
 

	
 
	/* Make sure essential parts of all windows are visible */
 
	RelocateAllWindows(_cur_resolution.width, _cur_resolution.height);
 
	MarkWholeScreenDirty();
 
}
 

	
0 comments (0 inline, 0 general)