summaryrefslogtreecommitdiff
path: root/main_gui.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-10-18 21:07:36 +0000
committerDarkvater <darkvater@openttd.org>2006-10-18 21:07:36 +0000
commitb944a133cb52958577ab8677bd2b8aff37c8c23d (patch)
tree0ef388b314faaa0af9ac16b072b33f57f028e6c6 /main_gui.c
parent034f5abc4b7b969bdcf176ecf91ee837912f208a (diff)
downloadopenttd-b944a133cb52958577ab8677bd2b8aff37c8c23d.tar.xz
(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)
Diffstat (limited to 'main_gui.c')
-rw-r--r--main_gui.c30
1 files changed, 29 insertions, 1 deletions
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;