- Add cvars cl_gamename, sv_heartbeat, sv_flatline so standalone games can customise their messages to the master server

This commit is contained in:
Thilo Schulz 2011-02-04 13:25:51 +00:00
parent 0eb5d1720c
commit 67a8b273c2
6 changed files with 60 additions and 18 deletions

View file

@ -100,6 +100,8 @@ cvar_t *cl_guidServerUniq;
cvar_t *cl_consoleKeys;
cvar_t *cl_gamename;
clientActive_t cl;
clientConnection_t clc;
clientStatic_t cls;
@ -3169,6 +3171,8 @@ void CL_Init( void ) {
// ~ and `, as keys and characters
cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60", CVAR_ARCHIVE);
cl_gamename = Cvar_Get("cl_gamename", GAMENAME_FOR_MASTER, CVAR_TEMP);
// userinfo
Cvar_Get ("name", "UnnamedPlayer", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get ("rate", "25000", CVAR_USERINFO | CVAR_ARCHIVE );
@ -3715,7 +3719,6 @@ void CL_GlobalServers_f( void ) {
netadr_t to;
int count, i, masterNum;
char command[1024], *masteraddress;
char *cmdname;
if ((count = Cmd_Argc()) < 3 || (masterNum = atoi(Cmd_Argv(1))) < 0 || masterNum > MAX_MASTER_SERVERS - 1)
{
@ -3753,14 +3756,24 @@ void CL_GlobalServers_f( void ) {
// Use the extended query for IPv6 masters
if (to.type == NA_IP6 || to.type == NA_MULTICAST6)
{
cmdname = "getserversExt " GAMENAME_FOR_MASTER;
int v4enabled = Cvar_VariableIntegerValue("net_enabled") & NET_ENABLEV4;
if(v4enabled)
{
Com_sprintf(command, sizeof(command), "getserversExt %s %s ipv6",
cl_gamename->string, Cmd_Argv(2));
}
else
{
Com_sprintf(command, sizeof(command), "getserversExt %s %s",
cl_gamename->string, Cmd_Argv(2));
}
// TODO: test if we only have an IPv6 connection. If it's the case,
// request IPv6 servers only by appending " ipv6" to the command
}
else
cmdname = "getservers";
Com_sprintf( command, sizeof(command), "%s %s", cmdname, Cmd_Argv(2) );
Com_sprintf(command, sizeof(command), "getservers %s", Cmd_Argv(2));
for (i=3; i < count; i++)
{