99 NetworkClientInfo *ci = DEREF_CLIENT_INFO(cs); |
99 NetworkClientInfo *ci = DEREF_CLIENT_INFO(cs); |
100 if (ci->client_name[0] == '\0') |
100 if (ci->client_name[0] == '\0') |
101 snprintf(client_name, size, "Client #%d", cs->index); |
101 snprintf(client_name, size, "Client #%d", cs->index); |
102 else |
102 else |
103 snprintf(client_name, size, "%s", ci->client_name); |
103 snprintf(client_name, size, "%s", ci->client_name); |
|
104 } |
|
105 |
|
106 byte NetworkSpectatorCount(void) |
|
107 { |
|
108 const NetworkClientState *cs; |
|
109 byte count = 0; |
|
110 |
|
111 FOR_ALL_CLIENTS(cs) { |
|
112 if (DEREF_CLIENT_INFO(cs)->client_playas == OWNER_SPECTATOR) count++; |
|
113 } |
|
114 |
|
115 return count; |
104 } |
116 } |
105 |
117 |
106 // This puts a text-message to the console, or in the future, the chat-box, |
118 // This puts a text-message to the console, or in the future, the chat-box, |
107 // (to keep it all a bit more general) |
119 // (to keep it all a bit more general) |
108 // If 'self_send' is true, this is the client who is sending the message |
120 // If 'self_send' is true, this is the client who is sending the message |
552 // Close the gap in the client-list |
564 // Close the gap in the client-list |
553 ci = DEREF_CLIENT_INFO(cs); |
565 ci = DEREF_CLIENT_INFO(cs); |
554 |
566 |
555 if (_network_server) { |
567 if (_network_server) { |
556 // We just lost one client :( |
568 // We just lost one client :( |
557 if (cs->status > STATUS_INACTIVE) { |
569 if (cs->status > STATUS_INACTIVE) _network_game_info.clients_on--; |
558 _network_game_info.clients_on--; |
|
559 if (DEREF_CLIENT_INFO(cs)->client_playas == OWNER_SPECTATOR) |
|
560 _network_game_info.spectators_on--; |
|
561 } |
|
562 _network_clients_connected--; |
570 _network_clients_connected--; |
563 |
571 |
564 while ((cs + 1) != DEREF_CLIENT(MAX_CLIENTS) && (cs + 1)->socket != INVALID_SOCKET) { |
572 while ((cs + 1) != DEREF_CLIENT(MAX_CLIENTS) && (cs + 1)->socket != INVALID_SOCKET) { |
565 *cs = *(cs + 1); |
573 *cs = *(cs + 1); |
566 *ci = *(ci + 1); |
574 *ci = *(ci + 1); |