/* * PF_StatQuery_GetAPI * * Overrides CreateQuery entry with proxy function. */ static stat_query_api_t *PF_StatQuery_GetAPI( void ) { static stat_query_api_t api; stat_query_api_t *p; p = StatQuery_GetAPI(); api = *p; api.CreateQuery = SV_MM_CreateQuery; return &api; }
void CL_MM_Init( void ) { if( cl_mm_initialized ) return; cl_mm_enabled = qfalse; cl_mm_loginState = LOGIN_STATE_NONE; cls.mm_session = 0; cl_mm_loginHandle = 0; cl_mm_loginState = LOGIN_STATE_NONE; cl_mm_loginTime = 0; cl_mm_loginRetries = 0; if( !cl_mm_mempool ) { cl_mm_errmsg = NULL; cl_mm_errmsg_size = 0; } if( !cl_mm_mempool ) cl_mm_mempool = Mem_AllocPool( NULL, "cl_mm" ); StatQuery_Init(); sq_api = StatQuery_GetAPI(); /* * create cvars */ cl_mm_session = Cvar_Get( "cl_mm_session", "0", CVAR_READONLY | CVAR_USERINFO ); cl_mm_autologin = Cvar_Get( "cl_mm_autologin", "0", CVAR_ARCHIVE ); // TODO: remove as cvar cl_mm_user = Cvar_Get( "cl_mm_user", "", CVAR_ARCHIVE ); /* * add commands */ Cmd_AddCommand( "mm_login", CL_MM_Login_f ); Cmd_AddCommand( "mm_logout", CL_MM_Logout_f ); Cvar_ForceSet( cl_mm_session->name, "0" ); /* * login */ if( cl_mm_autologin->integer ) CL_MM_Login( NULL, NULL ); cl_mm_initialized = qtrue; }
/* * SV_MM_Init */ void SV_MM_Init( void ) { sv_mm_initialized = qfalse; sv_mm_session = 0; sv_mm_localsession = 0; sv_mm_last_heartbeat = 0; sv_mm_logout_semaphore = qfalse; sv_mm_gameon = qfalse; sv_mm_match_uuid[0] = '\0'; sv_mm_next_match_uuid_fetch = Sys_Milliseconds(); sv_mm_match_uuid_fetch_query = NULL; sv_mm_match_uuid_callback_fn = NULL; StatQuery_Init(); sq_api = StatQuery_GetAPI(); /* * create cvars * ch : had to make sv_mm_enable to cmdline only, because of possible errors * if enabled while players on server */ sv_mm_enable = Cvar_Get( "sv_mm_enable", "0", CVAR_ARCHIVE | CVAR_NOSET | CVAR_SERVERINFO ); sv_mm_loginonly = Cvar_Get( "sv_mm_loginonly", "0", CVAR_ARCHIVE | CVAR_SERVERINFO ); sv_mm_debug_reportbots = Cvar_Get( "sv_mm_debug_reportbots", "0", CVAR_CHEAT ); // this is used by game, but to pass it to client, we'll initialize it in sv Cvar_Get( "sv_skillRating", va( "%.0f", MM_RATING_DEFAULT), CVAR_READONLY | CVAR_SERVERINFO ); // TODO: remove as cvar sv_mm_authkey = Cvar_Get( "sv_mm_authkey", "", CVAR_ARCHIVE ); /* * login */ sv_login_query = NULL; //if( sv_mm_enable->integer ) // SV_MM_Login(); sv_mm_enable->modified = qtrue; }