Make the qport flags a little more doc friendly.

This commit is contained in:
Bill Currie 2011-07-23 17:51:07 +09:00
parent adce93a2de
commit 2035e65bad
9 changed files with 25 additions and 21 deletions

View file

@ -162,6 +162,11 @@ qboolean ServerPaused (void);
#define MAX_LATENT 32
typedef enum {
NC_QPORT_SEND = 0x01,
NC_QPORT_READ = 0x02,
} ncqport_e;
typedef struct netchan_s {
qboolean fatal_error;
@ -177,7 +182,7 @@ typedef struct netchan_s {
int good_count; // cleared each level
netadr_t remote_address;
int qport;
ncqport_e qport;
int flags;
// bandwidth estimator
@ -217,10 +222,7 @@ void Netchan_Transmit (netchan_t *chan, int length, byte *data);
void Netchan_OutOfBand (netadr_t adr, int length, byte *data);
void Netchan_OutOfBandPrint (netadr_t adr, const char *format, ...) __attribute__((format(printf,2,3)));
qboolean Netchan_Process (netchan_t *chan);
void Netchan_Setup (netchan_t *chan, netadr_t adr, int qport, int flags);
#define NC_SEND_QPORT 0x01
#define NC_READ_QPORT 0x02
void Netchan_Setup (netchan_t *chan, netadr_t adr, ncqport_e qport, int flags);
qboolean Netchan_CanPacket (netchan_t *chan);
qboolean Netchan_CanReliable (netchan_t *chan);

View file

@ -187,7 +187,7 @@ Netchan_OutOfBandPrint (netadr_t adr, const char *format, ...)
called to open a channel to a remote system
*/
void
Netchan_Setup (netchan_t *chan, netadr_t adr, int qport, int flags)
Netchan_Setup (netchan_t *chan, netadr_t adr, ncqport_e qport, int flags)
{
memset (chan, 0, sizeof (*chan));
@ -286,7 +286,7 @@ Netchan_Transmit (netchan_t *chan, int length, byte *data)
MSG_WriteLong (&send, w2);
// send the qport if we are a client
if (chan->flags & NC_SEND_QPORT)
if (chan->flags & NC_QPORT_SEND)
MSG_WriteShort (&send, chan->qport);
// copy the reliable message to the packet first
@ -343,7 +343,7 @@ Netchan_Process (netchan_t *chan)
sequence_ack = MSG_ReadLong (net_message);
// read the qport if we are a server, but drop it
if (chan->flags & NC_READ_QPORT)
if (chan->flags & NC_QPORT_READ)
MSG_ReadShort (net_message);
reliable_message = sequence >> 31;

View file

@ -1148,7 +1148,7 @@ client_connect (connection_t *con, void *object)
cl = calloc (1, sizeof (client_t));
client_count++;
Netchan_Setup (&cl->netchan, con->address, qport, NC_READ_QPORT);
Netchan_Setup (&cl->netchan, con->address, qport, NC_QPORT_READ);
cl->clnext = clients;
clients = cl;
cl->userinfo = userinfo;

View file

@ -358,7 +358,7 @@ server_connect (connection_t *con, void *object)
return;
qtv_printf ("connection from %s\n", sv->name);
Netchan_Setup (&sv->netchan, con->address, sv->qport, NC_SEND_QPORT);
Netchan_Setup (&sv->netchan, con->address, sv->qport, NC_QPORT_SEND);
sv->netchan.outgoing_sequence = 1;
sv->connected = 1;
sv->playermodel = -1;
@ -461,7 +461,7 @@ sv_new_f (void)
Hash_Add (server_hash, sv);
sv->con = Connection_Add (&adr, sv, server_challenge);
Netchan_Setup (&sv->netchan, sv->con->address, sv->qport, NC_SEND_QPORT);
Netchan_Setup (&sv->netchan, sv->con->address, sv->qport, NC_QPORT_SEND);
server_getchallenge (sv->con, sv);
}

View file

@ -33,8 +33,8 @@
#define __sv_qtv_h
struct info_s;
void SV_qtvConnect (int qport, struct info_s *info);
int SV_qtvPacket (int qport);
void SV_qtvConnect (ncqport_e qport, struct info_s *info);
int SV_qtvPacket (ncqport_e qport);
void SV_qtvCheckTimeouts (void);
void SV_qtvSendMessages (void);
void SV_qtvFinalMessage (const char *message);

View file

@ -902,7 +902,7 @@ CL_StartDemo (void)
Sys_Printf ("qwd\n");
}
CL_SetState (ca_demostart);
Netchan_Setup (&cls.netchan, net_from, 0, NC_SEND_QPORT);
Netchan_Setup (&cls.netchan, net_from, 0, NC_QPORT_SEND);
realtime = 0;
cls.findtrack = true;
cls.lasttype = 0;

View file

@ -874,7 +874,7 @@ CL_ConnectionlessPacket (void)
Sys_Printf ("Dup connect received. Ignored.\n");
return;
}
Netchan_Setup (&cls.netchan, net_from, cls.qport, NC_SEND_QPORT);
Netchan_Setup (&cls.netchan, net_from, cls.qport, NC_QPORT_SEND);
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message, "new");
CL_SetState (ca_connected);

View file

@ -767,7 +767,8 @@ SVC_DirectConnect (void)
info_t *userinfo = 0;
const char *s;
client_t *cl, *newcl;
int challenge, qport, version, i, qtv = 0;
int challenge, version, i, qtv = 0;
ncqport_e qport;
netadr_t adr;
qboolean spectator;
client_frame_t *frames;
@ -908,7 +909,7 @@ SVC_DirectConnect (void)
Netchan_OutOfBandPrint (adr, "%c", S2C_CONNECTION);
Netchan_Setup (&newcl->netchan, adr, qport, NC_READ_QPORT);
Netchan_Setup (&newcl->netchan, adr, qport, NC_QPORT_READ);
newcl->backbuf.netchan = &newcl->netchan;
newcl->backbuf.name = newcl->name;
@ -1754,7 +1755,8 @@ SV_ReadPackets (void)
{
//NOTE star volatile, not volatile star
client_t *volatile cl; // * volatile for longjmp
int qport, i;
int i;
ncqport_e qport;
double until;
while (NET_GetPacket ()) {

View file

@ -398,7 +398,7 @@ qtv_reliable_send (sv_qtv_t *proxy)
}
void
SV_qtvConnect (int qport, info_t *info)
SV_qtvConnect (ncqport_e qport, info_t *info)
{
sv_qtv_t *proxy;
@ -413,7 +413,7 @@ SV_qtvConnect (int qport, info_t *info)
while (!(proxy->name_key = Hash_Find (proxy->info->tab, "name")))
Info_SetValueForKey (proxy->info, "name", "\"unnamed proxy\"", 1);
Netchan_Setup (&proxy->netchan, net_from, qport, NC_READ_QPORT);
Netchan_Setup (&proxy->netchan, net_from, qport, NC_QPORT_READ);
proxy->backbuf.netchan = &proxy->netchan;
proxy->backbuf.name = proxy->name_key->value;
proxy->datagram.data = proxy->datagram_buf;
@ -424,7 +424,7 @@ SV_qtvConnect (int qport, info_t *info)
}
int
SV_qtvPacket (int qport)
SV_qtvPacket (ncqport_e qport)
{
int i;