1184 } |
1184 } |
1185 } |
1185 } |
1186 |
1186 |
1187 ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX); |
1187 ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX); |
1188 // Register local player (if not dedicated) |
1188 // Register local player (if not dedicated) |
1189 if (ci != NULL && _local_player < MAX_PLAYERS) { |
1189 if (ci != NULL && ci->client_playas > 0 && ci->client_playas <= MAX_PLAYERS) |
1190 snprintf(_network_player_info[ci->client_playas-1].players, sizeof(_network_player_info[ci->client_playas-1].players), "%s", ci->client_name); |
1190 ttd_strlcpy(_network_player_info[ci->client_playas-1].players, ci->client_name, sizeof(_network_player_info[ci->client_playas-1].players)); |
1191 } |
|
1192 |
1191 |
1193 FOR_ALL_CLIENTS(cs) { |
1192 FOR_ALL_CLIENTS(cs) { |
1194 char client_name[NETWORK_NAME_LENGTH]; |
1193 char client_name[NETWORK_NAME_LENGTH]; |
1195 char temp[NETWORK_PLAYERS_LENGTH]; |
|
1196 |
1194 |
1197 NetworkGetClientName(client_name, sizeof(client_name), cs); |
1195 NetworkGetClientName(client_name, sizeof(client_name), cs); |
1198 |
1196 |
1199 ci = DEREF_CLIENT_INFO(cs); |
1197 ci = DEREF_CLIENT_INFO(cs); |
1200 if (ci != NULL && ci->client_playas <= MAX_PLAYERS) { |
1198 if (ci != NULL && ci->client_playas > 0 && ci->client_playas <= MAX_PLAYERS) { |
1201 if (_network_player_info[ci->client_playas-1].players[0] == '\0') |
1199 if (strlen(_network_player_info[ci->client_playas-1].players) != 0) |
1202 snprintf(_network_player_info[ci->client_playas-1].players, sizeof(_network_player_info[ci->client_playas-1].players), "%s", client_name); |
1200 strncat(_network_player_info[ci->client_playas-1].players, ", ", sizeof(_network_player_info[ci->client_playas-1].players)); |
1203 else { |
1201 |
1204 snprintf(temp, sizeof(temp), "%s, %s", _network_player_info[ci->client_playas-1].players, client_name); |
1202 strncat(_network_player_info[ci->client_playas-1].players, client_name, sizeof(_network_player_info[ci->client_playas-1].players)); |
1205 snprintf(_network_player_info[ci->client_playas-1].players, sizeof(_network_player_info[ci->client_playas-1].players), "%s", temp); |
|
1206 } |
|
1207 } |
1203 } |
1208 } |
1204 } |
1209 } |
1205 } |
1210 |
1206 |
1211 // Send a packet to all clients with updated info about this client_index |
1207 // Send a packet to all clients with updated info about this client_index |