Support sending extended game info in response to PACKET_CLIENT_GAME_INFO

This commit is contained in:
Jonathan G Rennison
2021-09-17 23:44:59 +01:00
parent 8a0821c96e
commit 7e39d3f24a
10 changed files with 70 additions and 7 deletions

View File

@@ -371,6 +371,19 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendGameInfo()
return NETWORK_RECV_STATUS_OKAY;
}
NetworkRecvStatus ServerNetworkGameSocketHandler::SendGameInfoExtended(PacketGameType reply_type, uint16 flags, uint16 version)
{
NetworkGameInfo ngi;
FillNetworkGameInfo(ngi);
Packet *p = new Packet(reply_type, SHRT_MAX);
SerializeNetworkGameInfoExtended(p, &ngi, flags, version);
this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY;
}
/** Send the client information about the companies. */
NetworkRecvStatus ServerNetworkGameSocketHandler::SendCompanyInfo()
{
@@ -881,7 +894,14 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendSettingsAccessUpdate(bool
NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_GAME_INFO(Packet *p)
{
return this->SendGameInfo();
if (p->CanReadFromPacket(9) && p->Recv_uint32() == FIND_SERVER_EXTENDED_TOKEN) {
PacketGameType reply_type = (PacketGameType)p->Recv_uint8();
uint16 flags = p->Recv_uint16();
uint16 version = p->Recv_uint16();
return this->SendGameInfoExtended(reply_type, flags, version);
} else {
return this->SendGameInfo();
}
}
NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_COMPANY_INFO(Packet *p)