|
@@ -61,6 +61,13 @@ DEF_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIEN
|
|
|
_network_game_info.map_set = _opt.landscape;
|
|
|
|
|
|
NetworkSend_uint8 (packet, NETWORK_GAME_INFO_VERSION);
|
|
|
|
|
|
/* NETWORK_GAME_INFO_VERSION = 2 */
|
|
|
NetworkSend_uint8 (packet, _network_game_info.companies_max);
|
|
|
NetworkSend_uint8 (packet, _network_game_info.companies_on);
|
|
|
NetworkSend_uint8 (packet, _network_game_info.spectators_max);
|
|
|
|
|
|
/* NETWORK_GAME_INFO_VERSION = 1 */
|
|
|
NetworkSend_string(packet, _network_game_info.server_name);
|
|
|
NetworkSend_string(packet, _network_game_info.server_revision);
|
|
|
NetworkSend_uint8 (packet, _network_game_info.server_lang);
|
|
@@ -103,7 +110,15 @@ DEF_UDP_RECEIVE_COMMAND(PACKET_UDP_SERVE
|
|
|
// Find next item
|
|
|
item = NetworkGameListAddItem(inet_addr(inet_ntoa(client_addr->sin_addr)), ntohs(client_addr->sin_port));
|
|
|
|
|
|
if (game_info_version == 1) {
|
|
|
/* Please observe the order. In the order in which packets are sent
|
|
|
* they are to be received */
|
|
|
switch (game_info_version) {
|
|
|
case 2:
|
|
|
item->info.companies_max = NetworkRecv_uint8(&_udp_cs, p);
|
|
|
item->info.companies_on = NetworkRecv_uint8(&_udp_cs, p);
|
|
|
item->info.spectators_max = NetworkRecv_uint8(&_udp_cs, p);
|
|
|
/* Fallthrough */
|
|
|
case 1:
|
|
|
NetworkRecv_string(&_udp_cs, p, item->info.server_name, sizeof(item->info.server_name));
|
|
|
NetworkRecv_string(&_udp_cs, p, item->info.server_revision, sizeof(item->info.server_revision));
|
|
|
item->info.server_lang = NetworkRecv_uint8(&_udp_cs, p);
|
|
@@ -127,6 +142,7 @@ DEF_UDP_RECEIVE_COMMAND(PACKET_UDP_SERVE
|
|
|
|
|
|
if (item->info.hostname[0] == '\0')
|
|
|
snprintf(item->info.hostname, sizeof(item->info.hostname), "%s", inet_ntoa(client_addr->sin_addr));
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
item->online = true;
|