(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)
This commit is contained in:
Darkvater
2006-10-18 21:07:36 +00:00
parent 95d9e4f4f1
commit c1bc092c76
3 changed files with 55 additions and 17 deletions

View File

@@ -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;