|
@@ -252,14 +252,12 @@ void SerializeNetworkGameInfo(Packet *p,
|
|
|
* Deserializes the NetworkGameInfo struct from the packet.
|
|
|
* @param p the packet to read the data from.
|
|
|
* @param info the NetworkGameInfo to deserialize into.
|
|
|
*/
|
|
|
void DeserializeNetworkGameInfo(Packet *p, NetworkGameInfo *info, const GameInfoNewGRFLookupTable *newgrf_lookup_table)
|
|
|
{
|
|
|
static const TimerGameCalendar::Date MAX_DATE = TimerGameCalendar::ConvertYMDToDate(MAX_YEAR, 11, 31); // December is month 11
|
|
|
|
|
|
byte game_info_version = p->Recv_uint8();
|
|
|
NewGRFSerializationType newgrf_serialisation = NST_GRFID_MD5;
|
|
|
|
|
|
/*
|
|
|
* Please observe the order.
|
|
|
* The parts must be read in the same order as they are sent!
|
|
@@ -320,14 +318,14 @@ void DeserializeNetworkGameInfo(Packet *
|
|
|
dst = &c->next;
|
|
|
}
|
|
|
FALLTHROUGH;
|
|
|
}
|
|
|
|
|
|
case 3:
|
|
|
info->game_date = Clamp(p->Recv_uint32(), 0, static_cast<int32_t>(MAX_DATE));
|
|
|
info->start_date = Clamp(p->Recv_uint32(), 0, static_cast<int32_t>(MAX_DATE));
|
|
|
info->game_date = Clamp(p->Recv_uint32(), 0, static_cast<int32_t>(CalendarTime::MAX_DATE));
|
|
|
info->start_date = Clamp(p->Recv_uint32(), 0, static_cast<int32_t>(CalendarTime::MAX_DATE));
|
|
|
FALLTHROUGH;
|
|
|
|
|
|
case 2:
|
|
|
info->companies_max = p->Recv_uint8 ();
|
|
|
info->companies_on = p->Recv_uint8 ();
|
|
|
p->Recv_uint8(); // Used to contain max-spectators.
|
|
@@ -339,14 +337,14 @@ void DeserializeNetworkGameInfo(Packet *
|
|
|
if (game_info_version < 6) p->Recv_uint8 (); // Used to contain server-lang.
|
|
|
info->use_password = p->Recv_bool ();
|
|
|
info->clients_max = p->Recv_uint8 ();
|
|
|
info->clients_on = p->Recv_uint8 ();
|
|
|
info->spectators_on = p->Recv_uint8 ();
|
|
|
if (game_info_version < 3) { // 16 bits dates got scrapped and are read earlier
|
|
|
info->game_date = p->Recv_uint16() + DAYS_TILL_ORIGINAL_BASE_YEAR;
|
|
|
info->start_date = p->Recv_uint16() + DAYS_TILL_ORIGINAL_BASE_YEAR;
|
|
|
info->game_date = p->Recv_uint16() + CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
|
|
|
info->start_date = p->Recv_uint16() + CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
|
|
|
}
|
|
|
if (game_info_version < 6) while (p->Recv_uint8() != 0) {} // Used to contain the map-name.
|
|
|
info->map_width = p->Recv_uint16();
|
|
|
info->map_height = p->Recv_uint16();
|
|
|
info->landscape = p->Recv_uint8 ();
|
|
|
info->dedicated = p->Recv_bool ();
|