Add another network broadcast mode.

This commit is contained in:
Jonathan G Rennison
2017-03-03 22:31:44 +00:00
parent 49e922daa6
commit c70a60fd18
2 changed files with 5 additions and 2 deletions

View File

@@ -1363,15 +1363,17 @@ void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, co
DEBUG(net, 0, "[server] received unknown chat destination type %d. Doing broadcast instead", desttype); DEBUG(net, 0, "[server] received unknown chat destination type %d. Doing broadcast instead", desttype);
/* FALL THROUGH */ /* FALL THROUGH */
case DESTTYPE_BROADCAST: case DESTTYPE_BROADCAST:
case DESTTYPE_BROADCAST_SS:
FOR_ALL_CLIENT_SOCKETS(cs) { FOR_ALL_CLIENT_SOCKETS(cs) {
cs->SendChat(action, from_id, false, msg, data); cs->SendChat(action, from_id, (desttype == DESTTYPE_BROADCAST_SS && from_id == cs->client_id), msg, data);
} }
NetworkAdminChat(action, desttype, from_id, msg, data, from_admin); NetworkAdminChat(action, desttype, from_id, msg, data, from_admin);
ci = NetworkClientInfo::GetByClientID(from_id); ci = NetworkClientInfo::GetByClientID(from_id);
if (ci != NULL) { if (ci != NULL) {
NetworkTextMessage(action, GetDrawStringCompanyColour(ci->client_playas), false, ci->client_name, msg, data); NetworkTextMessage(action, GetDrawStringCompanyColour(ci->client_playas),
(desttype == DESTTYPE_BROADCAST_SS && from_id == CLIENT_ID_SERVER), ci->client_name, msg, data);
} }
break; break;
} }

View File

@@ -81,6 +81,7 @@ enum NetworkPasswordType {
/** Destination of our chat messages. */ /** Destination of our chat messages. */
enum DestType { enum DestType {
DESTTYPE_BROADCAST, ///< Send message/notice to all clients (All) DESTTYPE_BROADCAST, ///< Send message/notice to all clients (All)
DESTTYPE_BROADCAST_SS, ///< Send message/notice to all clients (All), but tag the broadcast to self as a self-send
DESTTYPE_TEAM, ///< Send message/notice to everyone playing the same company (Team) DESTTYPE_TEAM, ///< Send message/notice to everyone playing the same company (Team)
DESTTYPE_CLIENT, ///< Send message/notice to only a certain client (Private) DESTTYPE_CLIENT, ///< Send message/notice to only a certain client (Private)
}; };