Fixed a warning, but the names of the stuff I added are only suggestions so you might want to tweak them.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2614 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Molgrum 2007-08-30 02:05:50 +00:00
parent 4861637b3b
commit 6afef2b2f0
3 changed files with 16 additions and 15 deletions

View file

@ -2475,12 +2475,11 @@ void CL_ReadPackets (void)
#ifdef NQPROT #ifdef NQPROT
switch(NQNetChan_Process(&cls.netchan)) switch(NQNetChan_Process(&cls.netchan))
{ {
case 0: case NQP_ERROR:
break; break;
case 1://datagram case NQP_DATAGRAM://datagram
// if (cls.n
cls.netchan.incoming_sequence = cls.netchan.outgoing_sequence - 3; cls.netchan.incoming_sequence = cls.netchan.outgoing_sequence - 3;
case 2://reliable case NQP_RELIABLE://reliable
CLNQ_ParseServerMessage (); CLNQ_ParseServerMessage ();
break; break;
} }

View file

@ -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 {NS_CLIENT, NS_SERVER} netsrc_t;
typedef enum {NQP_ERROR, NQP_DATAGRAM, NQP_RELIABLE} nqprot_t;
typedef struct typedef struct
{ {
netadrtype_t type; 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_CanPacket (netchan_t *chan, int rate);
qboolean Netchan_CanReliable (netchan_t *chan, int rate); qboolean Netchan_CanReliable (netchan_t *chan, int rate);
#ifdef NQPROT #ifdef NQPROT
qboolean NQNetChan_Process(netchan_t *chan); nqprot_t NQNetChan_Process(netchan_t *chan);
#endif #endif
#ifdef HUFFNETWORK #ifdef HUFFNETWORK

View file

@ -230,7 +230,7 @@ qboolean ServerPaused(void);
#endif #endif
#ifdef NQPROT #ifdef NQPROT
qboolean NQNetChan_Process(netchan_t *chan) nqprot_t NQNetChan_Process(netchan_t *chan)
{ {
int header; int header;
int sequence; int sequence;
@ -240,10 +240,10 @@ qboolean NQNetChan_Process(netchan_t *chan)
header = LongSwap(MSG_ReadLong()); header = LongSwap(MSG_ReadLong());
if (net_message.cursize != (header & NETFLAG_LENGTH_MASK)) 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) if (header & NETFLAG_CTL)
return false; //huh? return NQP_ERROR; //huh?
sequence = LongSwap(MSG_ReadLong()); sequence = LongSwap(MSG_ReadLong());
@ -267,7 +267,7 @@ qboolean NQNetChan_Process(netchan_t *chan)
else if (sequence > chan->reliable_sequence) else if (sequence > chan->reliable_sequence)
Con_Printf("Future ack recieved\n"); 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) if (header & NETFLAG_UNRELIABLE)
@ -275,7 +275,7 @@ qboolean NQNetChan_Process(netchan_t *chan)
if (sequence < chan->incoming_unreliable) if (sequence < chan->incoming_unreliable)
{ {
Con_DPrintf("Stale datagram recieved\n"); Con_DPrintf("Stale datagram recieved\n");
return false; return NQP_ERROR;
} }
drop = sequence - chan->incoming_unreliable - 1; drop = sequence - chan->incoming_unreliable - 1;
if (drop > 0) if (drop > 0)
@ -289,7 +289,7 @@ qboolean NQNetChan_Process(netchan_t *chan)
chan->incoming_acknowledged++; chan->incoming_acknowledged++;
chan->good_count++; chan->good_count++;
return 1; return NQP_DATAGRAM;
} }
if (header & NETFLAG_DATA) 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)) if (chan->in_fragment_length + net_message.cursize-8 >= sizeof(chan->in_fragment_buf))
{ {
chan->fatal_error = true; 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); 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); SZ_Write(&net_message, chan->in_fragment_buf, chan->in_fragment_length);
chan->in_fragment_length = 0; chan->in_fragment_length = 0;
MSG_BeginReading(); MSG_BeginReading();
return 2; //we can read it now return NQP_RELIABLE; //we can read it now
} }
} }
else else
Con_DPrintf("Stale reliable (%i)\n", sequence); Con_DPrintf("Stale reliable (%i)\n", sequence);
return false; return NQP_ERROR;
} }
return false; //not supported. return NQP_ERROR; //not supported.
} }
#endif #endif