From 5c0ae9964254a1e5f0d1d7861728398b581382bb Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Tue, 25 Jan 2011 02:04:25 +0000 Subject: [PATCH] Make number of supported master servers tunable via define --- code/client/cl_main.c | 4 ++-- code/qcommon/q_shared.h | 3 ++- code/server/server.h | 6 ------ code/server/sv_init.c | 15 +++++++++------ 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/code/client/cl_main.c b/code/client/cl_main.c index 2b4be3a5..0c9d9e4f 100644 --- a/code/client/cl_main.c +++ b/code/client/cl_main.c @@ -3717,9 +3717,9 @@ void CL_GlobalServers_f( void ) { char command[1024], *masteraddress; char *cmdname; - if ((count = Cmd_Argc()) < 3 || (masterNum = atoi(Cmd_Argv(1))) < 0 || masterNum > 4) + if ((count = Cmd_Argc()) < 3 || (masterNum = atoi(Cmd_Argv(1))) < 0 || masterNum > MAX_MASTER_SERVERS - 1) { - Com_Printf( "usage: globalservers [keywords]\n"); + Com_Printf("usage: globalservers [keywords]\n", MAX_MASTER_SERVERS - 1); return; } diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h index 1e575c82..1699d08b 100644 --- a/code/qcommon/q_shared.h +++ b/code/qcommon/q_shared.h @@ -48,7 +48,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define Q3_VERSION PRODUCT_NAME " " PRODUCT_VERSION -#define MAX_TEAMNAME 32 +#define MAX_TEAMNAME 32 +#define MAX_MASTER_SERVERS 5 // number of supported master servers #ifdef _MSC_VER diff --git a/code/server/server.h b/code/server/server.h index bf85594e..ce7b1ab5 100644 --- a/code/server/server.h +++ b/code/server/server.h @@ -212,10 +212,6 @@ typedef struct { qboolean connected; } challenge_t; - -#define MAX_MASTERS 8 // max recipients for heartbeat packets - - // this structure will be cleared only when the game dll changes typedef struct { qboolean initialized; // sv_init has completed @@ -252,8 +248,6 @@ extern serverStatic_t svs; // persistant server info across maps extern server_t sv; // cleared each map extern vm_t *gvm; // game virtual machine -#define MAX_MASTER_SERVERS 5 - extern cvar_t *sv_fps; extern cvar_t *sv_timeout; extern cvar_t *sv_zombietime; diff --git a/code/server/sv_init.c b/code/server/sv_init.c index bac7fa43..faf3b68d 100644 --- a/code/server/sv_init.c +++ b/code/server/sv_init.c @@ -624,7 +624,10 @@ SV_Init Only called at main exe startup, not for each game =============== */ -void SV_Init (void) { +void SV_Init (void) +{ + int index; + SV_AddOperatorCommands (); // serverinfo vars @@ -668,11 +671,11 @@ void SV_Init (void) { sv_allowDownload = Cvar_Get ("sv_allowDownload", "0", CVAR_SERVERINFO); Cvar_Get ("sv_dlURL", "", CVAR_SERVERINFO | CVAR_ARCHIVE); - sv_master[0] = Cvar_Get ("sv_master1", MASTER_SERVER_NAME, 0 ); - sv_master[1] = Cvar_Get ("sv_master2", "", CVAR_ARCHIVE ); - sv_master[2] = Cvar_Get ("sv_master3", "", CVAR_ARCHIVE ); - sv_master[3] = Cvar_Get ("sv_master4", "", CVAR_ARCHIVE ); - sv_master[4] = Cvar_Get ("sv_master5", "", CVAR_ARCHIVE ); + + sv_master[0] = Cvar_Get("sv_master1", MASTER_SERVER_NAME, 0); + for(index = 1; index < MAX_MASTER_SERVERS; index++) + sv_master[index] = Cvar_Get(va("sv_master%d", index + 1), "", CVAR_ARCHIVE); + sv_reconnectlimit = Cvar_Get ("sv_reconnectlimit", "3", 0); sv_showloss = Cvar_Get ("sv_showloss", "0", 0); sv_padPackets = Cvar_Get ("sv_padPackets", "0", 0);