Make number of supported master servers tunable via define

This commit is contained in:
Thilo Schulz 2011-01-25 02:04:25 +00:00
parent bf07014b1d
commit 5c0ae99642
4 changed files with 13 additions and 15 deletions

View file

@ -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 <master# 0-4> <protocol> [keywords]\n");
Com_Printf("usage: globalservers <master# 0-%d> <protocol> [keywords]\n", MAX_MASTER_SERVERS - 1);
return;
}

View file

@ -49,6 +49,7 @@ 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_MASTER_SERVERS 5 // number of supported master servers
#ifdef _MSC_VER

View file

@ -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;

View file

@ -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 );
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);