diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index ba0180b72..17015f19e 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -2475,12 +2475,11 @@ void CL_ReadPackets (void) #ifdef NQPROT switch(NQNetChan_Process(&cls.netchan)) { - case 0: + case NQP_ERROR: break; - case 1://datagram -// if (cls.n + case NQP_DATAGRAM://datagram cls.netchan.incoming_sequence = cls.netchan.outgoing_sequence - 3; - case 2://reliable + case NQP_RELIABLE://reliable CLNQ_ParseServerMessage (); break; } diff --git a/engine/common/net.h b/engine/common/net.h index d7ab557ce..20cc28c44 100644 --- a/engine/common/net.h +++ b/engine/common/net.h @@ -25,6 +25,8 @@ typedef enum {NA_INVALID, NA_LOOPBACK, NA_IP, NA_IPV6, NA_IPX, NA_BROADCAST_IP, typedef enum {NS_CLIENT, NS_SERVER} netsrc_t; +typedef enum {NQP_ERROR, NQP_DATAGRAM, NQP_RELIABLE} nqprot_t; + typedef struct { netadrtype_t type; @@ -168,7 +170,7 @@ void Netchan_Setup (netsrc_t sock, netchan_t *chan, netadr_t adr, int qport); qboolean Netchan_CanPacket (netchan_t *chan, int rate); qboolean Netchan_CanReliable (netchan_t *chan, int rate); #ifdef NQPROT -qboolean NQNetChan_Process(netchan_t *chan); +nqprot_t NQNetChan_Process(netchan_t *chan); #endif #ifdef HUFFNETWORK diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index 56e114371..ce1d4a01b 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -230,7 +230,7 @@ qboolean ServerPaused(void); #endif #ifdef NQPROT -qboolean NQNetChan_Process(netchan_t *chan) +nqprot_t NQNetChan_Process(netchan_t *chan) { int header; int sequence; @@ -240,10 +240,10 @@ qboolean NQNetChan_Process(netchan_t *chan) header = LongSwap(MSG_ReadLong()); if (net_message.cursize != (header & NETFLAG_LENGTH_MASK)) - return false; //size was wrong, couldn't have been ours. + return NQP_ERROR; //size was wrong, couldn't have been ours. if (header & NETFLAG_CTL) - return false; //huh? + return NQP_ERROR; //huh? sequence = LongSwap(MSG_ReadLong()); @@ -267,7 +267,7 @@ qboolean NQNetChan_Process(netchan_t *chan) else if (sequence > chan->reliable_sequence) Con_Printf("Future ack recieved\n"); - return false; //don't try execing the 'payload'. I hate ack packets. + return NQP_ERROR; //don't try execing the 'payload'. I hate ack packets. } if (header & NETFLAG_UNRELIABLE) @@ -275,7 +275,7 @@ qboolean NQNetChan_Process(netchan_t *chan) if (sequence < chan->incoming_unreliable) { Con_DPrintf("Stale datagram recieved\n"); - return false; + return NQP_ERROR; } drop = sequence - chan->incoming_unreliable - 1; if (drop > 0) @@ -289,7 +289,7 @@ qboolean NQNetChan_Process(netchan_t *chan) chan->incoming_acknowledged++; chan->good_count++; - return 1; + return NQP_DATAGRAM; } if (header & NETFLAG_DATA) { @@ -307,7 +307,7 @@ qboolean NQNetChan_Process(netchan_t *chan) if (chan->in_fragment_length + net_message.cursize-8 >= sizeof(chan->in_fragment_buf)) { chan->fatal_error = true; - return false; + return NQP_ERROR; } memcpy(chan->in_fragment_buf + chan->in_fragment_length, net_message.data+8, net_message.cursize-8); @@ -319,15 +319,15 @@ qboolean NQNetChan_Process(netchan_t *chan) SZ_Write(&net_message, chan->in_fragment_buf, chan->in_fragment_length); chan->in_fragment_length = 0; MSG_BeginReading(); - return 2; //we can read it now + return NQP_RELIABLE; //we can read it now } } else Con_DPrintf("Stale reliable (%i)\n", sequence); - return false; + return NQP_ERROR; } - return false; //not supported. + return NQP_ERROR; //not supported. } #endif