* Rename voip cvar to cl_voip

* s/#if USE_VOIP/#ifdef USE_VOIP/
* Add generalised runtime cvar range checking, currently on [sv|cl]_voip,
  dedicated and a bunch of r_ variables
This commit is contained in:
Tim Angus 2008-07-07 22:31:39 +00:00
parent 809c361744
commit 37d664d4b2
24 changed files with 239 additions and 110 deletions

View file

@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define MAX_ENT_CLUSTERS 16
#if USE_VOIP
#ifdef USE_VOIP
typedef struct voipServerPacket_s
{
int generation;
@ -179,7 +179,7 @@ typedef struct client_s {
netchan_buffer_t *netchan_start_queue;
netchan_buffer_t **netchan_end_queue;
#if USE_VOIP
#ifdef USE_VOIP
qboolean hasVoip;
qboolean muteAllVoip;
qboolean ignoreVoipFromClient[MAX_CLIENTS];
@ -284,7 +284,7 @@ extern cvar_t *sv_strictAuth;
extern serverBan_t serverBans[SERVER_MAXBANS];
extern int serverBansCount;
#if USE_VOIP
#ifdef USE_VOIP
extern cvar_t *sv_voip;
#endif
@ -345,7 +345,7 @@ void SV_ClientThink (client_t *cl, usercmd_t *cmd);
void SV_WriteDownloadToClient( client_t *cl , msg_t *msg );
#if USE_VOIP
#ifdef USE_VOIP
void SV_WriteVoipToClient( client_t *cl, msg_t *msg );
#endif

View file

@ -1083,7 +1083,7 @@ void SV_WriteDownloadToClient( client_t *cl , msg_t *msg )
}
}
#if USE_VOIP
#ifdef USE_VOIP
/*
==================
SV_WriteVoipToClient
@ -1378,10 +1378,10 @@ void SV_UserinfoChanged( client_t *cl ) {
cl->snapshotMsec = 50;
}
#if USE_VOIP
#ifdef USE_VOIP
// in the future, (val) will be a protocol version string, so only
// accept explicitly 1, not generally non-zero.
val = Info_ValueForKey (cl->userinfo, "voip");
val = Info_ValueForKey (cl->userinfo, "cl_voip");
cl->hasVoip = (atoi(val) == 1) ? qtrue : qfalse;
#endif
@ -1421,7 +1421,7 @@ static void SV_UpdateUserinfo_f( client_t *cl ) {
}
#if USE_VOIP
#ifdef USE_VOIP
static
void SV_UpdateVoipIgnore(client_t *cl, const char *idstr, qboolean ignore)
{
@ -1468,7 +1468,7 @@ static ucmd_t ucmds[] = {
{"stopdl", SV_StopDownload_f},
{"donedl", SV_DoneDownload_f},
#if USE_VOIP
#ifdef USE_VOIP
{"voip", SV_Voip_f},
#endif
@ -1692,7 +1692,7 @@ static void SV_UserMove( client_t *cl, msg_t *msg, qboolean delta ) {
}
#if USE_VOIP
#ifdef USE_VOIP
static
qboolean SV_ShouldIgnoreVoipSender(const client_t *cl)
{
@ -1922,7 +1922,7 @@ void SV_ExecuteClientMessage( client_t *cl, msg_t *msg ) {
} else if ( c == clc_moveNoDelta ) {
SV_UserMove( cl, msg, qfalse );
} else if ( c == clc_voip ) {
#if USE_VOIP
#ifdef USE_VOIP
SV_UserVoip( cl, msg );
#endif
} else if ( c != clc_EOF ) {

View file

@ -654,12 +654,9 @@ void SV_Init (void) {
Cvar_Get ("sv_cheats", "1", CVAR_SYSTEMINFO | CVAR_ROM );
sv_serverid = Cvar_Get ("sv_serverid", "0", CVAR_SYSTEMINFO | CVAR_ROM );
sv_pure = Cvar_Get ("sv_pure", "1", CVAR_SYSTEMINFO );
#if USE_VOIP
#ifdef USE_VOIP
sv_voip = Cvar_Get ("sv_voip", "1", CVAR_SYSTEMINFO | CVAR_LATCH);
if ( (sv_voip->integer < 0) || (sv_voip->integer > 1) ) {
Com_Printf("WARNING: sv_voip must be 0 or 1. Setting to 1.");
Cvar_Set ("sv_voip", "1");
}
Cvar_CheckRange( sv_voip, 0, 1, qtrue );
#endif
Cvar_Get ("sv_paks", "", CVAR_SYSTEMINFO | CVAR_ROM );
Cvar_Get ("sv_pakNames", "", CVAR_SYSTEMINFO | CVAR_ROM );

View file

@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "server.h"
#if USE_VOIP
#ifdef USE_VOIP
cvar_t *sv_voip;
#endif
@ -411,9 +411,9 @@ void SVC_Info( netadr_t from ) {
Info_SetValueForKey( infostring, "gametype", va("%i", sv_gametype->integer ) );
Info_SetValueForKey( infostring, "pure", va("%i", sv_pure->integer ) );
#if USE_VOIP
#ifdef USE_VOIP
if (sv_voip->integer) {
Info_SetValueForKey( infostring, "voip", va("%i", sv_voip->integer ) );
Info_SetValueForKey( infostring, "cl_voip", va("%i", sv_voip->integer ) );
}
#endif

View file

@ -653,7 +653,7 @@ void SV_SendClientSnapshot( client_t *client ) {
// Add any download data if the client is downloading
SV_WriteDownloadToClient( client, &msg );
#if USE_VOIP
#ifdef USE_VOIP
SV_WriteVoipToClient( client, &msg );
#endif