mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-25 21:41:57 +00:00
no more #ifdef SERVERONLY in net_chan.c
This commit is contained in:
parent
5879669155
commit
74d4cd2399
6 changed files with 27 additions and 22 deletions
|
@ -247,6 +247,13 @@ typedef struct
|
||||||
challenge_t challenges[MAX_CHALLENGES]; // to prevent invalid IPs from connecting
|
challenge_t challenges[MAX_CHALLENGES]; // to prevent invalid IPs from connecting
|
||||||
} server_static_t;
|
} server_static_t;
|
||||||
|
|
||||||
|
typedef struct foobar_s {
|
||||||
|
qboolean demoplayback;
|
||||||
|
int qport;
|
||||||
|
} foobar_t;
|
||||||
|
|
||||||
|
extern foobar_t cls;
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
// edict->movetype values
|
// edict->movetype values
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
#include <quakedef.h>
|
#include <quakedef.h>
|
||||||
|
|
||||||
|
qboolean ServerPaused (void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void SV_Error (char *error, ...)
|
void SV_Error (char *error, ...)
|
||||||
{
|
{
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
|
|
|
@ -88,6 +88,7 @@ int net_drop;
|
||||||
cvar_t showpackets = {"showpackets", "0"};
|
cvar_t showpackets = {"showpackets", "0"};
|
||||||
cvar_t showdrop = {"showdrop", "0"};
|
cvar_t showdrop = {"showdrop", "0"};
|
||||||
cvar_t qport = {"qport", "0"};
|
cvar_t qport = {"qport", "0"};
|
||||||
|
extern qboolean is_server;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
|
@ -134,9 +135,7 @@ void Netchan_OutOfBand (netadr_t adr, int length, byte *data)
|
||||||
|
|
||||||
// send the datagram
|
// send the datagram
|
||||||
//zoid, no input in demo playback mode
|
//zoid, no input in demo playback mode
|
||||||
#ifndef SERVERONLY
|
|
||||||
if (!cls.demoplayback)
|
if (!cls.demoplayback)
|
||||||
#endif
|
|
||||||
NET_SendPacket (send.cursize, send.data, adr);
|
NET_SendPacket (send.cursize, send.data, adr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,9 +214,7 @@ qboolean Netchan_CanReliable (netchan_t *chan)
|
||||||
return Netchan_CanPacket (chan);
|
return Netchan_CanPacket (chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SERVERONLY
|
|
||||||
qboolean ServerPaused(void);
|
qboolean ServerPaused(void);
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
|
@ -277,9 +274,8 @@ void Netchan_Transmit (netchan_t *chan, int length, byte *data)
|
||||||
MSG_WriteLong (&send, w2);
|
MSG_WriteLong (&send, w2);
|
||||||
|
|
||||||
// send the qport if we are a client
|
// send the qport if we are a client
|
||||||
#ifndef SERVERONLY
|
if(!is_server)
|
||||||
MSG_WriteShort (&send, cls.qport);
|
MSG_WriteShort (&send, cls.qport);
|
||||||
#endif
|
|
||||||
|
|
||||||
// copy the reliable message to the packet first
|
// copy the reliable message to the packet first
|
||||||
if (send_reliable)
|
if (send_reliable)
|
||||||
|
@ -298,19 +294,15 @@ void Netchan_Transmit (netchan_t *chan, int length, byte *data)
|
||||||
chan->outgoing_time[i] = realtime;
|
chan->outgoing_time[i] = realtime;
|
||||||
|
|
||||||
//zoid, no input in demo playback mode
|
//zoid, no input in demo playback mode
|
||||||
#ifndef SERVERONLY
|
|
||||||
if (!cls.demoplayback)
|
if (!cls.demoplayback)
|
||||||
#endif
|
|
||||||
NET_SendPacket (send.cursize, send.data, chan->remote_address);
|
NET_SendPacket (send.cursize, send.data, chan->remote_address);
|
||||||
|
|
||||||
if (chan->cleartime < realtime)
|
if (chan->cleartime < realtime)
|
||||||
chan->cleartime = realtime + send.cursize*chan->rate;
|
chan->cleartime = realtime + send.cursize*chan->rate;
|
||||||
else
|
else
|
||||||
chan->cleartime += send.cursize*chan->rate;
|
chan->cleartime += send.cursize*chan->rate;
|
||||||
#ifdef SERVERONLY
|
|
||||||
if (ServerPaused())
|
if (ServerPaused())
|
||||||
chan->cleartime = realtime;
|
chan->cleartime = realtime;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (showpackets.value)
|
if (showpackets.value)
|
||||||
Con_Printf ("--> s=%i(%i) a=%i(%i) %i\n"
|
Con_Printf ("--> s=%i(%i) a=%i(%i) %i\n"
|
||||||
|
@ -334,16 +326,13 @@ qboolean Netchan_Process (netchan_t *chan)
|
||||||
{
|
{
|
||||||
unsigned sequence, sequence_ack;
|
unsigned sequence, sequence_ack;
|
||||||
unsigned reliable_ack, reliable_message;
|
unsigned reliable_ack, reliable_message;
|
||||||
#ifdef SERVERONLY
|
|
||||||
int qport;
|
int qport;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (
|
if ( !cls.demoplayback &&
|
||||||
#ifndef SERVERONLY
|
|
||||||
!cls.demoplayback &&
|
|
||||||
#endif
|
|
||||||
!NET_CompareAdr (net_from, chan->remote_address))
|
!NET_CompareAdr (net_from, chan->remote_address))
|
||||||
return false;
|
return false;
|
||||||
|
else if (is_server && !NET_CompareAdr (net_from, chan->remote_address))
|
||||||
|
return false;
|
||||||
|
|
||||||
// get sequence numbers
|
// get sequence numbers
|
||||||
MSG_BeginReading ();
|
MSG_BeginReading ();
|
||||||
|
@ -351,9 +340,8 @@ qboolean Netchan_Process (netchan_t *chan)
|
||||||
sequence_ack = MSG_ReadLong ();
|
sequence_ack = MSG_ReadLong ();
|
||||||
|
|
||||||
// read the qport if we are a server
|
// read the qport if we are a server
|
||||||
#ifdef SERVERONLY
|
if (is_server)
|
||||||
qport = MSG_ReadShort ();
|
qport = MSG_ReadShort ();
|
||||||
#endif
|
|
||||||
|
|
||||||
reliable_message = sequence >> 31;
|
reliable_message = sequence >> 31;
|
||||||
reliable_ack = sequence_ack >> 31;
|
reliable_ack = sequence_ack >> 31;
|
||||||
|
|
|
@ -25,6 +25,9 @@
|
||||||
|
|
||||||
$Id$
|
$Id$
|
||||||
*/
|
*/
|
||||||
|
#include "qwsvdef.h"
|
||||||
|
|
||||||
|
foobar_t cls = {true, 0};
|
||||||
|
|
||||||
void
|
void
|
||||||
Draw_BeginDisc(void)
|
Draw_BeginDisc(void)
|
||||||
|
|
|
@ -52,6 +52,7 @@ int nostdout = 0;
|
||||||
|
|
||||||
char *basedir = ".";
|
char *basedir = ".";
|
||||||
char *cachedir = "/tmp";
|
char *cachedir = "/tmp";
|
||||||
|
qboolean is_server = false;
|
||||||
|
|
||||||
cvar_t sys_linerefresh = {"sys_linerefresh","0"};// set for entity display
|
cvar_t sys_linerefresh = {"sys_linerefresh","0"};// set for entity display
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ cvar_t sys_nostdout = {"sys_nostdout","0"};
|
||||||
cvar_t sys_extrasleep = {"sys_extrasleep","0"};
|
cvar_t sys_extrasleep = {"sys_extrasleep","0"};
|
||||||
|
|
||||||
qboolean stdin_ready;
|
qboolean stdin_ready;
|
||||||
|
qboolean is_server = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============================================================================
|
===============================================================================
|
||||||
|
|
Loading…
Reference in a new issue