Skip to content

Commit

Permalink
Make changing com_gamename use dpmaster protocol instead of efmaster
Browse files Browse the repository at this point in the history
  • Loading branch information
zturtleman committed Sep 18, 2017
1 parent d7b202d commit f4edc94
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 18 deletions.
5 changes: 0 additions & 5 deletions code/client/cl_main.c
Expand Up @@ -4401,13 +4401,8 @@ void CL_GlobalServers_f( void ) {
Com_sprintf(command, sizeof(command), "getservers %s",
Cmd_Argv(2));
else
#ifdef ELITEFORCE
Com_sprintf(command, sizeof(command), "getservers %s",
Cmd_Argv(2));
#else
Com_sprintf(command, sizeof(command), "getservers %s %s",
com_gamename->string, Cmd_Argv(2));
#endif

for (i=3; i < count; i++)
{
Expand Down
11 changes: 6 additions & 5 deletions code/qcommon/q_shared.h
Expand Up @@ -75,16 +75,17 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#endif

// Heartbeat for dpmaster protocol. You shouldn't change this unless you know what you're doing
#ifdef ELITEFORCE
#define HEARTBEAT_FOR_MASTER "STEF1"
#else
#define HEARTBEAT_FOR_MASTER "DarkPlaces"
#endif
#define HEARTBEAT_FOR_MASTER "DarkPlaces"

// When com_gamename is LEGACY_MASTER_GAMENAME, use quake3 master protocol.
// You shouldn't change this unless you know what you're doing
#ifdef ELITEFORCE
#define LEGACY_MASTER_GAMENAME "EliteForce"
#define LEGACY_HEARTBEAT_FOR_MASTER "STEF1"
#else
#define LEGACY_MASTER_GAMENAME "Quake3Arena"
#define LEGACY_HEARTBEAT_FOR_MASTER "QuakeArena-1"
#endif

#define BASETA "missionpack"

Expand Down
31 changes: 23 additions & 8 deletions code/server/sv_main.c
Expand Up @@ -243,6 +243,9 @@ void SV_MasterHeartbeat(const char *message)
int i;
int res;
int netenabled;
#ifdef ELITEFORCE
qboolean dpmasterProtocol;
#endif

netenabled = Cvar_VariableIntegerValue("net_enabled");

Expand All @@ -254,8 +257,17 @@ void SV_MasterHeartbeat(const char *message)
if ( svs.time < svs.nextHeartbeatTime )
return;

#ifdef ELITEFORCE
if ( !Q_stricmp( com_gamename->string, LEGACY_MASTER_GAMENAME ) ) {
message = LEGACY_HEARTBEAT_FOR_MASTER;
dpmasterProtocol = qfalse;
} else {
dpmasterProtocol = qtrue;
}
#else
if ( !Q_stricmp( com_gamename->string, LEGACY_MASTER_GAMENAME ) )
message = LEGACY_HEARTBEAT_FOR_MASTER;
#endif

svs.nextHeartbeatTime = svs.time + HEARTBEAT_MSEC;

Expand Down Expand Up @@ -319,18 +331,21 @@ void SV_MasterHeartbeat(const char *message)
// ever incompatably changes

#ifdef ELITEFORCE
if(adr[i][0].type != NA_BAD)
NET_OutOfBandPrint(NS_SERVER, adr[i][0], "\\heartbeat\\%d\\gamename\\%s\\",
Cvar_VariableIntegerValue("net_port"), message);
if(adr[i][1].type != NA_BAD)
NET_OutOfBandPrint(NS_SERVER, adr[i][1], "\\heartbeat\\%d\\gamename\\%s\\",
Cvar_VariableIntegerValue("net_port6"), message);
#else
if ( !dpmasterProtocol ) {
if(adr[i][0].type != NA_BAD)
NET_OutOfBandPrint(NS_SERVER, adr[i][0], "\\heartbeat\\%d\\gamename\\%s\\",
Cvar_VariableIntegerValue("net_port"), message);
if(adr[i][1].type != NA_BAD)
NET_OutOfBandPrint(NS_SERVER, adr[i][1], "\\heartbeat\\%d\\gamename\\%s\\",
Cvar_VariableIntegerValue("net_port6"), message);
continue;
}
#endif

if(adr[i][0].type != NA_BAD)
NET_OutOfBandPrint( NS_SERVER, adr[i][0], "heartbeat %s\n", message);
if(adr[i][1].type != NA_BAD)
NET_OutOfBandPrint( NS_SERVER, adr[i][1], "heartbeat %s\n", message);
#endif
}
}

Expand Down

0 comments on commit f4edc94

Please sign in to comment.