1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-09-01 02:49:10 +00:00

Codechange: Check that CompanyMask fits into 16 bits during compilation.

This commit is contained in:
2023-04-07 10:21:22 +01:00
committed by PeterN
parent 5199881a8d
commit 47e12a8790
2 changed files with 2 additions and 0 deletions

View File

@@ -1120,6 +1120,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_COMPANY_UPDATE(
{ {
if (this->status < STATUS_ACTIVE) return NETWORK_RECV_STATUS_MALFORMED_PACKET; if (this->status < STATUS_ACTIVE) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
static_assert(sizeof(_network_company_passworded) <= sizeof(uint16));
_network_company_passworded = p->Recv_uint16(); _network_company_passworded = p->Recv_uint16();
SetWindowClassesDirty(WC_COMPANY); SetWindowClassesDirty(WC_COMPANY);

View File

@@ -775,6 +775,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendCompanyUpdate()
{ {
Packet *p = new Packet(PACKET_SERVER_COMPANY_UPDATE); Packet *p = new Packet(PACKET_SERVER_COMPANY_UPDATE);
static_assert(sizeof(_network_company_passworded) <= sizeof(uint16));
p->Send_uint16(_network_company_passworded); p->Send_uint16(_network_company_passworded);
this->SendPacket(p); this->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY; return NETWORK_RECV_STATUS_OKAY;