188 |
188 |
189 /* NETWORK_GAME_INFO_VERSION = 1 */ |
189 /* NETWORK_GAME_INFO_VERSION = 1 */ |
190 p->Send_string(info->server_name); |
190 p->Send_string(info->server_name); |
191 p->Send_string(info->server_revision); |
191 p->Send_string(info->server_revision); |
192 p->Send_uint8 (info->server_lang); |
192 p->Send_uint8 (info->server_lang); |
193 p->Send_uint8 (info->use_password); |
193 p->Send_bool (info->use_password); |
194 p->Send_uint8 (info->clients_max); |
194 p->Send_uint8 (info->clients_max); |
195 p->Send_uint8 (info->clients_on); |
195 p->Send_uint8 (info->clients_on); |
196 p->Send_uint8 (info->spectators_on); |
196 p->Send_uint8 (info->spectators_on); |
197 p->Send_string(info->map_name); |
197 p->Send_string(info->map_name); |
198 p->Send_uint16(info->map_width); |
198 p->Send_uint16(info->map_width); |
199 p->Send_uint16(info->map_height); |
199 p->Send_uint16(info->map_height); |
200 p->Send_uint8 (info->map_set); |
200 p->Send_uint8 (info->map_set); |
201 p->Send_uint8 (info->dedicated); |
201 p->Send_bool (info->dedicated); |
202 } |
202 } |
203 |
203 |
204 /** |
204 /** |
205 * Deserializes the NetworkGameInfo struct from the packet |
205 * Deserializes the NetworkGameInfo struct from the packet |
206 * @param p the packet to read the data from |
206 * @param p the packet to read the data from |
247 /* Fallthrough */ |
247 /* Fallthrough */ |
248 case 1: |
248 case 1: |
249 p->Recv_string(info->server_name, sizeof(info->server_name)); |
249 p->Recv_string(info->server_name, sizeof(info->server_name)); |
250 p->Recv_string(info->server_revision, sizeof(info->server_revision)); |
250 p->Recv_string(info->server_revision, sizeof(info->server_revision)); |
251 info->server_lang = p->Recv_uint8 (); |
251 info->server_lang = p->Recv_uint8 (); |
252 info->use_password = (p->Recv_uint8 () != 0); |
252 info->use_password = p->Recv_bool (); |
253 info->clients_max = p->Recv_uint8 (); |
253 info->clients_max = p->Recv_uint8 (); |
254 info->clients_on = p->Recv_uint8 (); |
254 info->clients_on = p->Recv_uint8 (); |
255 info->spectators_on = p->Recv_uint8 (); |
255 info->spectators_on = p->Recv_uint8 (); |
256 if (info->game_info_version < 3) { // 16 bits dates got scrapped and are read earlier |
256 if (info->game_info_version < 3) { // 16 bits dates got scrapped and are read earlier |
257 info->game_date = p->Recv_uint16() + DAYS_TILL_ORIGINAL_BASE_YEAR; |
257 info->game_date = p->Recv_uint16() + DAYS_TILL_ORIGINAL_BASE_YEAR; |
259 } |
259 } |
260 p->Recv_string(info->map_name, sizeof(info->map_name)); |
260 p->Recv_string(info->map_name, sizeof(info->map_name)); |
261 info->map_width = p->Recv_uint16(); |
261 info->map_width = p->Recv_uint16(); |
262 info->map_height = p->Recv_uint16(); |
262 info->map_height = p->Recv_uint16(); |
263 info->map_set = p->Recv_uint8 (); |
263 info->map_set = p->Recv_uint8 (); |
264 info->dedicated = (p->Recv_uint8() != 0); |
264 info->dedicated = p->Recv_bool (); |
265 |
265 |
266 if (info->server_lang >= NETWORK_NUM_LANGUAGES) info->server_lang = 0; |
266 if (info->server_lang >= NETWORK_NUM_LANGUAGES) info->server_lang = 0; |
267 if (info->map_set >= NETWORK_NUM_LANDSCAPES) info->map_set = 0; |
267 if (info->map_set >= NETWORK_NUM_LANDSCAPES) info->map_set = 0; |
268 } |
268 } |
269 } |
269 } |