From 80e25417be92abff3053a4d8f209349a16e6d334 Mon Sep 17 00:00:00 2001 From: tma Date: Mon, 7 Jul 2008 22:31:39 +0000 Subject: * 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 git-svn-id: svn://svn.icculus.org/quake3/trunk@1420 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/server/server.h | 8 ++++---- code/server/sv_client.c | 14 +++++++------- code/server/sv_init.c | 7 ++----- code/server/sv_main.c | 6 +++--- code/server/sv_snapshot.c | 2 +- 5 files changed, 17 insertions(+), 20 deletions(-) (limited to 'code/server') diff --git a/code/server/server.h b/code/server/server.h index 61fd882..64c4d1e 100644 --- a/code/server/server.h +++ b/code/server/server.h @@ -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 diff --git a/code/server/sv_client.c b/code/server/sv_client.c index 180bbf3..5554ebf 100644 --- a/code/server/sv_client.c +++ b/code/server/sv_client.c @@ -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 ) { diff --git a/code/server/sv_init.c b/code/server/sv_init.c index 97154f0..52102ce 100644 --- a/code/server/sv_init.c +++ b/code/server/sv_init.c @@ -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 ); diff --git a/code/server/sv_main.c b/code/server/sv_main.c index 667db41..6a941e2 100644 --- a/code/server/sv_main.c +++ b/code/server/sv_main.c @@ -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 diff --git a/code/server/sv_snapshot.c b/code/server/sv_snapshot.c index 71fdc8b..2e0ad92 100644 --- a/code/server/sv_snapshot.c +++ b/code/server/sv_snapshot.c @@ -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 -- cgit v1.2.3