mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 19:20:46 +00:00
Update Net_SendVersion() and Net_ReceiveVersion() to use a 16-bit representation of BYTEVERSION
git-svn-id: https://svn.eduke32.com/eduke32@3155 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
39437b2fdc
commit
00084e9e22
1 changed files with 7 additions and 7 deletions
|
@ -981,21 +981,21 @@ void Net_SendVersion(ENetPeer *client)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf[0] = PACKET_VERSION;
|
*(uint16_t *)&buf[0] = PACKET_VERSION;
|
||||||
buf[1] = BYTEVERSION;
|
buf[2] = BYTEVERSION;
|
||||||
// XXX: s_buildDate is outdated and useless; uint8 is not enough :/
|
// XXX: s_buildDate is outdated and useless; uint8 is not enough :/
|
||||||
buf[2] = (uint8_t)atoi(s_buildDate);
|
buf[3] = (uint8_t)atoi(s_buildDate);
|
||||||
buf[3] = myconnectindex;
|
buf[4] = myconnectindex;
|
||||||
|
|
||||||
enet_peer_send(client, CHAN_GAMESTATE, enet_packet_create(&buf[0], 4, ENET_PACKET_FLAG_RELIABLE));
|
enet_peer_send(client, CHAN_GAMESTATE, enet_packet_create(&buf[0], 5, ENET_PACKET_FLAG_RELIABLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Net_RecieveVersion(uint8_t *pbuf, int32_t packbufleng)
|
void Net_RecieveVersion(uint8_t *pbuf, int32_t packbufleng)
|
||||||
{
|
{
|
||||||
if (pbuf[1] != BYTEVERSION || pbuf[2] != (uint8_t)atoi(s_buildDate))
|
if (*(uint16_t *)&pbuf[1] != BYTEVERSION || pbuf[3] != (uint8_t)atoi(s_buildDate))
|
||||||
{
|
{
|
||||||
initprintf("Server protocol is version %d.%d, expecting %d.%d\n",
|
initprintf("Server protocol is version %d.%d, expecting %d.%d\n",
|
||||||
pbuf[1], pbuf[2], BYTEVERSION, (uint8_t)atoi(s_buildDate));
|
*(uint16_t *)&pbuf[1], pbuf[3], BYTEVERSION, (uint8_t)atoi(s_buildDate));
|
||||||
initprintf("Server version mismatch! You cannot play Duke with different versions!\n");
|
initprintf("Server version mismatch! You cannot play Duke with different versions!\n");
|
||||||
g_netDisconnect = 1;
|
g_netDisconnect = 1;
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue