diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index b1d9859fb..74b8e4b72 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -579,7 +579,7 @@ void CL_CheckForResend (void) Con_TPrintf (TLC_CONNECTINGTO, cls.servername); - MSG_WriteLong(&sb, BigLong(NETFLAG_CTL | (strlen(NET_GAMENAME_NQ)+7))); + MSG_WriteLong(&sb, LongSwap(NETFLAG_CTL | (strlen(NET_GAMENAME_NQ)+7))); MSG_WriteByte(&sb, CCREQ_CONNECT); MSG_WriteString(&sb, NET_GAMENAME_NQ); MSG_WriteByte(&sb, NET_PROTOCOL_VERSION); @@ -1970,7 +1970,7 @@ void CLNQ_ConnectionlessPacket(void) int length; MSG_BeginReading (); - length = BigLong(MSG_ReadLong ()); + length = LongSwap(MSG_ReadLong ()); if (!(length & NETFLAG_CTL)) return; //not an nq control packet. length &= NETFLAG_LENGTH_MASK; diff --git a/engine/common/common.h b/engine/common/common.h index efd9b60a3..04ca85024 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -109,6 +109,9 @@ extern int (*LittleLong) (int l); extern float (*BigFloat) (float l); extern float (*LittleFloat) (float l); +short ShortSwap (short l); +int LongSwap (int l); + //============================================================================ struct usercmd_s; diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index 6c5e29b5e..61882a00b 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -238,14 +238,14 @@ qboolean NQNetChan_Process(netchan_t *chan) MSG_BeginReading (); - header = BigLong(MSG_ReadLong()); + header = LongSwap(MSG_ReadLong()); if (net_message.cursize != (header & NETFLAG_LENGTH_MASK)) return false; //size was wrong, couldn't have been ours. if (header & NETFLAG_CTL) return false; //huh? - sequence = BigLong(MSG_ReadLong()); + sequence = LongSwap(MSG_ReadLong()); if (header & NETFLAG_ACK) { @@ -364,7 +364,7 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate) if (i>0) { MSG_WriteLong(&send, 0); - MSG_WriteLong(&send, BigLong(chan->reliable_sequence)); + MSG_WriteLong(&send, LongSwap(chan->reliable_sequence)); if (i > MAX_NQDATAGRAM) i = MAX_NQDATAGRAM; @@ -392,7 +392,7 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate) if (length) { MSG_WriteLong(&send, 0); - MSG_WriteLong(&send, BigLong(chan->outgoing_unreliable)); + MSG_WriteLong(&send, LongSwap(chan->outgoing_unreliable)); chan->outgoing_unreliable++; SZ_Write (&send, data, length); diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 716c53ad7..6337f7b58 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -1164,7 +1164,7 @@ void SV_AcceptMessage(int protocol) SZ_Clear(&sb); MSG_WriteLong(&sb, 0); MSG_WriteByte(&sb, CCREP_ACCEPT); - MSG_WriteLong(&sb, BigShort(net_local_sv_ipadr.port)); + MSG_WriteLong(&sb, ShortSwap(net_local_sv_ipadr.port)); *(int*)sb.data = BigLong(NETFLAG_CTL|sb.cursize); NET_SendPacket(NS_SERVER, sb.cursize, sb.data, net_from); return; @@ -2081,7 +2081,7 @@ void SVNQ_ConnectionlessPacket(void) return; //no, start using dp7 instead. MSG_BeginReading(); - header = BigLong(MSG_ReadLong()); + header = LongSwap(MSG_ReadLong()); if (!(header & NETFLAG_CTL)) return; //no idea what it is.