net: send BYTEVERSION as two bytes, high byte first.

Now we don't need to worry about the numbers running out soon.
Bump BYTEVERSION by three to celebrate this, too.

git-svn-id: https://svn.eduke32.com/eduke32@2209 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-12-25 15:34:37 +00:00
parent ff6284ea8c
commit a3a80467a7
2 changed files with 9 additions and 21 deletions

View file

@ -68,21 +68,8 @@ extern "C" {
#define SAMESIZE_ACTOR_T
// increase by 3, because atomic GRP adds 1, and Shareware adds 2
#ifdef YAX_ENABLE
// we'll have to introduce a BYTEVERSION2 sooner or later anyway...:
# ifdef SAMESIZE_ACTOR_T
# define BYTEVERSION_JF 231
# else
# define BYTEVERSION_JF 228
# endif
// keep in sync? v^v
#else
# ifdef SAMESIZE_ACTOR_T
# define BYTEVERSION_JF 201
# else
# define BYTEVERSION_JF 198
# endif
#endif
#define BYTEVERSION_JF 234
#define BYTEVERSION_13 27
#define BYTEVERSION_14 116
#define BYTEVERSION_15 117

View file

@ -184,11 +184,12 @@ static void Net_SendVersion(ENetPeer *client)
if (!g_netServer) return;
buf[0] = PACKET_VERSION;
buf[1] = BYTEVERSION;
buf[2] = (uint8_t)atoi(s_buildDate);
buf[3] = myconnectindex;
buf[1] = BYTEVERSION>>16;
buf[2] = BYTEVERSION&255;
buf[3] = (uint8_t)atoi(s_buildDate);
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_SendClientInfo(void)
@ -1997,10 +1998,10 @@ void Net_ParseServerPacket(ENetEvent *event)
break;
case PACKET_VERSION:
if (pbuf[1] != BYTEVERSION || pbuf[2] != (uint8_t)atoi(s_buildDate))
if (pbuf[1] != BYTEVERSION>>16 || pbuf[2] != (BYTEVERSION&255) || pbuf[3] != (uint8_t)atoi(s_buildDate))
{
initprintf("Server protocol is version %d.%d, expecting %d.%d\n",
pbuf[1], pbuf[2], BYTEVERSION, (uint8_t)atoi(s_buildDate));
((pbuf[1]<<16)|pbuf[2]), pbuf[3], BYTEVERSION, (uint8_t)atoi(s_buildDate));
initprintf("Server version mismatch! You cannot play Duke with different versions!\n");
g_netDisconnect = 1;
return;