From d8b261370a9665ba1cf34ceef32f857dfb6e80cd Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 23 Sep 2023 04:08:35 +0300 Subject: [PATCH] engine: common: do not probe server to collect cvars for game.cfg (CHECK THIS) --- engine/common/common.h | 2 -- engine/common/con_utils.c | 8 -------- engine/server/sv_init.c | 22 ---------------------- 3 files changed, 32 deletions(-) diff --git a/engine/common/common.h b/engine/common/common.h index 08160029..c382fbcd 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -747,8 +747,6 @@ void SV_ShutdownGame( void ); void SV_ExecLoadLevel( void ); void SV_ExecLoadGame( void ); void SV_ExecChangeLevel( void ); -qboolean SV_InitGameProgs( void ); -void SV_FreeGameProgs( void ); void CL_WriteMessageHistory( void ); void CL_SendCmd( void ); void CL_Disconnect( void ); diff --git a/engine/common/con_utils.c b/engine/common/con_utils.c index 1be94c0a..7a763d9e 100644 --- a/engine/common/con_utils.c +++ b/engine/common/con_utils.c @@ -1423,15 +1423,11 @@ save serverinfo variables into server.cfg (using for dedicated server too) */ void GAME_EXPORT Host_WriteServerConfig( const char *name ) { - qboolean already_loaded; file_t *f; string newconfigfile; Q_snprintf( newconfigfile, MAX_STRING, "%s.new", name ); - // TODO: remove this mechanism, make it safer for now - already_loaded = SV_InitGameProgs(); // collect user variables - // FIXME: move this out until menu parser is done CSCR_LoadDefaultCVars( "settings.scr" ); @@ -1448,10 +1444,6 @@ void GAME_EXPORT Host_WriteServerConfig( const char *name ) Host_FinalizeConfig( f, name ); } else Con_DPrintf( S_ERROR "Couldn't write %s.\n", name ); - - // don't unload library that wasn't loaded by us - if( !already_loaded ) - SV_FreeGameProgs(); // release progs with all variables } /* diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index ce2c7ac3..87ae350e 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -1115,28 +1115,6 @@ int SV_GetMaxClients( void ) return svs.maxclients; } -qboolean SV_InitGameProgs( void ) -{ - string dllpath; - - if( svgame.hInstance ) return true; // already loaded - - COM_GetCommonLibraryPath( LIBRARY_SERVER, dllpath, sizeof( dllpath )); - - // just try to initialize - SV_LoadProgs( dllpath ); - - return false; -} - -void SV_FreeGameProgs( void ) -{ - if( svs.initialized ) return; // server is active - - // unload progs (free cvars and commands) - SV_UnloadProgs(); -} - /* ================ SV_ExecLoadLevel