diff options
author | rubidium <rubidium@openttd.org> | 2009-10-07 17:36:33 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-10-07 17:36:33 +0000 |
commit | 58a36f038b7e668cde92d89630a2e8e32a67b2c3 (patch) | |
tree | d813aba3450c794ba9e0b4246be894af3710e137 /src/network/network_chat_gui.cpp | |
parent | c53682810f4f6462840a3da9521e48d0bfd57e05 (diff) | |
download | openttd-58a36f038b7e668cde92d89630a2e8e32a67b2c3.tar.xz |
(svn r17737) -Codechange: remove the chat window when you were chatting with someone who lost his/her connection or when you were team chatting and moved out of the company.
Diffstat (limited to 'src/network/network_chat_gui.cpp')
-rw-r--r-- | src/network/network_chat_gui.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index 317b547c2..3d10b72d0 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -277,7 +277,7 @@ struct NetworkChatWindow : public QueryStringBaseWindow { StringID dest_string; int dest; - NetworkChatWindow (const WindowDesc *desc, DestType type, int dest) : QueryStringBaseWindow(NETWORK_CHAT_LENGTH) + NetworkChatWindow(const WindowDesc *desc, DestType type, int dest) : QueryStringBaseWindow(NETWORK_CHAT_LENGTH) { this->dtype = type; this->dest = dest; @@ -292,14 +292,14 @@ struct NetworkChatWindow : public QueryStringBaseWindow { assert((uint)this->dtype < lengthof(chat_captions)); this->dest_string = chat_captions[this->dtype]; - this->InitNested(desc); + this->InitNested(desc, type); this->SetFocusedWidget(NWCW_TEXTBOX); InvalidateWindowData(WC_NEWS_WINDOW, 0, this->height); _chat_tab_completion_active = false; } - ~NetworkChatWindow () + ~NetworkChatWindow() { InvalidateWindowData(WC_NEWS_WINDOW, 0, 0); } @@ -505,6 +505,11 @@ struct NetworkChatWindow : public QueryStringBaseWindow { { ShowOnScreenKeyboard(this, wid, NWCW_CLOSE, NWCW_SENDBUTTON); } + + virtual void OnInvalidateData(int data) + { + if (data == this->dest) delete this; + } }; static const NWidgetPart _nested_chat_window_widgets[] = { @@ -530,8 +535,8 @@ static const WindowDesc _chat_window_desc( void ShowNetworkChatQueryWindow(DestType type, int dest) { - DeleteWindowById(WC_SEND_NETWORK_MSG, 0); - new NetworkChatWindow (&_chat_window_desc, type, dest); + DeleteWindowByClass(WC_SEND_NETWORK_MSG); + new NetworkChatWindow(&_chat_window_desc, type, dest); } #endif /* ENABLE_NETWORK */ |