From b944a133cb52958577ab8677bd2b8aff37c8c23d Mon Sep 17 00:00:00 2001 From: Darkvater Date: Wed, 18 Oct 2006 21:07:36 +0000 Subject: (svn r6824) -Feature: Change the functionality of the chat window. SHIFT+ENTER (SHIFT+T) sends a message to all players, CTRL+ENTER (CTRL+T) sends a message to all team mates and ENTER (T) sends a message to teammates if you have any, otherwise to all players. The chat-window now also shows what kind of message is being sent. Shortcut functionality has not been changed (ENTER sends message, ESC closes window) --- main_gui.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'main_gui.c') diff --git a/main_gui.c b/main_gui.c index cfec20260..8334496a1 100644 --- a/main_gui.c +++ b/main_gui.c @@ -2326,9 +2326,37 @@ static void MainWindowWndProc(Window *w, WindowEvent *e) break; #ifdef ENABLE_NETWORK - case WKC_RETURN: case 'T' | WKC_SHIFT: + case WKC_RETURN: case 'T': // smart chat; send to team if any, otherwise to all + if (_networking) { + const NetworkClientInfo *ci; + const NetworkClientInfo *cio = NetworkFindClientInfoFromIndex(_network_own_client_index); + bool has_team = false; + + /* Only players actually playing can speak to team. Eg spectators cannot */ + if (IsValidPlayer(cio->client_playas)) { + FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { + if (ci->client_playas == cio->client_playas && ci != cio) { + has_team = true; + break; + } + } + } + + ShowNetworkChatQueryWindow(has_team ? DESTTYPE_PLAYER : DESTTYPE_BROADCAST, ci->client_playas); + break; + } + break; + + case WKC_SHIFT | WKC_RETURN: case WKC_SHIFT | 'T': // send text message to all players if (_networking) ShowNetworkChatQueryWindow(DESTTYPE_BROADCAST, 0); break; + + case WKC_CTRL | WKC_RETURN: case WKC_CTRL | 'T': // send text to all team mates + if (_networking) { + const NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(_network_own_client_index); + ShowNetworkChatQueryWindow(DESTTYPE_PLAYER, ci->client_playas); + } + break; #endif default: return; -- cgit v1.2.3-70-g09d2