diff options
-rw-r--r-- | network.c | 12 | ||||
-rw-r--r-- | network_data.h | 1 | ||||
-rw-r--r-- | network_server.c | 4 | ||||
-rw-r--r-- | players.c | 7 |
4 files changed, 15 insertions, 9 deletions
@@ -130,11 +130,17 @@ void CDECL NetworkTextMessage(NetworkAction action, uint16 color, bool self_send va_end(va); switch (action) { + case NETWORK_ACTION_SERVER_MESSAGE: + color = 1; + snprintf(message, sizeof(message), "*** %s", buf); + break; case NETWORK_ACTION_JOIN: + color = 1; GetString(temp, STR_NETWORK_CLIENT_JOINED, lastof(temp)); snprintf(message, sizeof(message), "*** %s %s", name, temp); break; case NETWORK_ACTION_LEAVE: + color = 1; GetString(temp, STR_NETWORK_ERR_LEFT, lastof(temp)); snprintf(message, sizeof(message), "*** %s %s (%s)", name, temp, buf); break; @@ -303,13 +309,13 @@ void CheckMinPlayers(void) _min_players_paused = true; DoCommandP(0, 1, 0, NULL, CMD_PAUSE); - NetworkServer_HandleChat(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0, "Game paused (not enough players)", NETWORK_SERVER_INDEX); + NetworkServer_HandleChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "Game paused (not enough players)", NETWORK_SERVER_INDEX); } else { if (!_min_players_paused) return; _min_players_paused = false; DoCommandP(0, 0, 0, NULL, CMD_PAUSE); - NetworkServer_HandleChat(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0, "Game unpaused (enough players)", NETWORK_SERVER_INDEX); + NetworkServer_HandleChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "Game unpaused (enough players)", NETWORK_SERVER_INDEX); } } @@ -605,7 +611,7 @@ void NetworkCloseClient(NetworkClientState *cs) /* When the client was PRE_ACTIVE, the server was in pause mode, so unpause */ if (cs->status == STATUS_PRE_ACTIVE && _network_pause_on_join) { DoCommandP(0, 0, 0, NULL, CMD_PAUSE); - NetworkServer_HandleChat(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0, "Game unpaused", NETWORK_SERVER_INDEX); + NetworkServer_HandleChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "Game unpaused", NETWORK_SERVER_INDEX); } closesocket(cs->socket); diff --git a/network_data.h b/network_data.h index 40a2b5704..80724a8de 100644 --- a/network_data.h +++ b/network_data.h @@ -98,6 +98,7 @@ typedef enum { typedef enum { NETWORK_ACTION_JOIN, NETWORK_ACTION_LEAVE, + NETWORK_ACTION_SERVER_MESSAGE, NETWORK_ACTION_CHAT, NETWORK_ACTION_CHAT_COMPANY, NETWORK_ACTION_CHAT_CLIENT, diff --git a/network_server.c b/network_server.c index f8e4b61c8..61f32335e 100644 --- a/network_server.c +++ b/network_server.c @@ -752,7 +752,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_MAP_OK) /* Now pause the game till the client is in sync */ DoCommandP(0, 1, 0, NULL, CMD_PAUSE); - NetworkServer_HandleChat(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0, "Game paused (incoming client)", NETWORK_SERVER_INDEX); + NetworkServer_HandleChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "Game paused (incoming client)", NETWORK_SERVER_INDEX); } } else { // Wrong status for this packet, give a warning to client, and close connection @@ -958,7 +958,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_ACK) if (_network_pause_on_join) { DoCommandP(0, 0, 0, NULL, CMD_PAUSE); - NetworkServer_HandleChat(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0, "Game unpaused (client connected)", NETWORK_SERVER_INDEX); + NetworkServer_HandleChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "Game unpaused (client connected)", NETWORK_SERVER_INDEX); } CheckMinPlayers(); @@ -30,10 +30,9 @@ uint16 GetDrawStringPlayerColor(PlayerID player) { - /* Get the color for DrawString-subroutines which matches the color of the - * player - */ - if (player == PLAYER_SPECTATOR || player == PLAYER_SPECTATOR - 1) return 1; + /* Get the color for DrawString-subroutines which matches the color + * of the player */ + if (!IsValidPlayer(player)) return _colour_gradient[COLOUR_WHITE][4] | IS_PALETTE_COLOR; return (_colour_gradient[_player_colors[player]][4]) | IS_PALETTE_COLOR; } |