diff options
author | yexo <yexo@openttd.org> | 2010-08-31 12:18:28 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-08-31 12:18:28 +0000 |
commit | 0068c02244236506d7acf3caa74c144cb28ec203 (patch) | |
tree | 1bf38c40e0eeae37aed3ba15a355c3989eb13403 /src/network | |
parent | 1906dc80afeab4fa9811dde4b8c57429a330fbc7 (diff) | |
download | openttd-0068c02244236506d7acf3caa74c144cb28ec203.tar.xz |
(svn r20705) -Fix: graphic glitch when switching to a different-sized font while the chat message box was visible
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/network_chat_gui.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index 57c4ac6c3..ce6064e8c 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -112,16 +112,22 @@ void CDECL NetworkAddChatMessage(TextColour colour, uint8 duration, const char * _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++) { |