Browse Source

engine: server: convert public_server cvar to static allocation

pull/2/head
Alibek Omarov 2 years ago
parent
commit
892e5c59eb
  1. 2
      engine/server/server.h
  2. 9
      engine/server/sv_main.c

2
engine/server/server.h

@ -443,6 +443,7 @@ extern convar_t hostname;
extern convar_t skill; extern convar_t skill;
extern convar_t coop; extern convar_t coop;
extern convar_t sv_cheats; extern convar_t sv_cheats;
extern convar_t public_server;
extern convar_t *sv_pausable; // allows pause in multiplayer extern convar_t *sv_pausable; // allows pause in multiplayer
extern convar_t *sv_check_errors; extern convar_t *sv_check_errors;
@ -451,7 +452,6 @@ extern convar_t *sv_lighting_modulate;
extern convar_t *sv_novis; extern convar_t *sv_novis;
extern convar_t *sv_hostmap; extern convar_t *sv_hostmap;
extern convar_t *sv_validate_changelevel; extern convar_t *sv_validate_changelevel;
extern convar_t *public_server;
//=========================================================== //===========================================================
// //

9
engine/server/sv_main.c

@ -123,13 +123,14 @@ CVAR_DEFINE_AUTO( sv_voicequality, "3", FCVAR_ARCHIVE|FCVAR_SERVER, "voice chat
CVAR_DEFINE_AUTO( sv_enttools_enable, "0", FCVAR_ARCHIVE|FCVAR_PROTECTED, "enable powerful and dangerous entity tools" ); CVAR_DEFINE_AUTO( sv_enttools_enable, "0", FCVAR_ARCHIVE|FCVAR_PROTECTED, "enable powerful and dangerous entity tools" );
CVAR_DEFINE_AUTO( sv_enttools_maxfire, "5", FCVAR_ARCHIVE|FCVAR_PROTECTED, "limit ent_fire actions count to prevent flooding" ); CVAR_DEFINE_AUTO( sv_enttools_maxfire, "5", FCVAR_ARCHIVE|FCVAR_PROTECTED, "limit ent_fire actions count to prevent flooding" );
CVAR_DEFINE( public_server, "public", "0", 0, "change server type from private to public" );
convar_t *sv_novis; // disable server culling entities by vis convar_t *sv_novis; // disable server culling entities by vis
convar_t *sv_pausable; convar_t *sv_pausable;
convar_t *timeout; // seconds without any message convar_t *timeout; // seconds without any message
convar_t *sv_lighting_modulate; convar_t *sv_lighting_modulate;
convar_t *sv_maxclients; convar_t *sv_maxclients;
convar_t *sv_check_errors; convar_t *sv_check_errors;
convar_t *public_server; // should heartbeats be sent
convar_t *sv_reconnect_limit; // minimum seconds between connect messages convar_t *sv_reconnect_limit; // minimum seconds between connect messages
convar_t *sv_validate_changelevel; convar_t *sv_validate_changelevel;
convar_t *sv_sendvelocity; convar_t *sv_sendvelocity;
@ -716,7 +717,7 @@ let it know we are alive, and log information
*/ */
static void Master_Heartbeat( void ) static void Master_Heartbeat( void )
{ {
if(( !public_server->value && !sv_nat.value ) || svs.maxclients == 1 ) if(( !public_server.value && !sv_nat.value ) || svs.maxclients == 1 )
return; // only public servers send heartbeats return; // only public servers send heartbeats
// check for time wraparound // check for time wraparound
@ -935,7 +936,7 @@ void SV_Init( void )
Cvar_RegisterVariable( &sv_stopspeed ); Cvar_RegisterVariable( &sv_stopspeed );
sv_maxclients = Cvar_Get( "maxplayers", "1", FCVAR_LATCH, "server max capacity" ); sv_maxclients = Cvar_Get( "maxplayers", "1", FCVAR_LATCH, "server max capacity" );
sv_check_errors = Cvar_Get( "sv_check_errors", "0", FCVAR_ARCHIVE, "check edicts for errors" ); sv_check_errors = Cvar_Get( "sv_check_errors", "0", FCVAR_ARCHIVE, "check edicts for errors" );
public_server = Cvar_Get ("public", "0", 0, "change server type from private to public" ); Cvar_RegisterVariable( &public_server );
sv_lighting_modulate = Cvar_Get( "r_lighting_modulate", "0.6", FCVAR_ARCHIVE, "lightstyles modulate scale" ); sv_lighting_modulate = Cvar_Get( "r_lighting_modulate", "0.6", FCVAR_ARCHIVE, "lightstyles modulate scale" );
sv_reconnect_limit = Cvar_Get ("sv_reconnect_limit", "3", FCVAR_ARCHIVE, "max reconnect attempts" ); sv_reconnect_limit = Cvar_Get ("sv_reconnect_limit", "3", FCVAR_ARCHIVE, "max reconnect attempts" );
Cvar_RegisterVariable( &sv_failuretime ); Cvar_RegisterVariable( &sv_failuretime );
@ -1112,7 +1113,7 @@ void SV_Shutdown( const char *finalmsg )
if( svs.clients ) if( svs.clients )
SV_FinalMessage( finalmsg, false ); SV_FinalMessage( finalmsg, false );
if( public_server->value && svs.maxclients != 1 ) if( public_server.value && svs.maxclients != 1 )
Master_Shutdown(); Master_Shutdown();
NET_Config( false, false ); NET_Config( false, false );

Loading…
Cancel
Save