void SV_InitBanlist(){ Com_Memset(svse.ipBans,0,sizeof(svse.ipBans)); banlist = Cvar_RegisterString("banlistfile", "banlist.dat", CVAR_INIT, "Name of the file which holds the banlist"); current_banlist_size = BANLIST_DEFAULT_SIZE; current_banindex = 0; svse.banList = realloc(NULL, current_banlist_size);//Test for NULL ? if(svse.banList){ SV_LoadBanlist(); }else{ Com_PrintError("Failed to allocate memory for the banlist. Banlist is disabled\n"); } }
void SV_InitBanlist(){ Com_Memset(ipBans,0,sizeof(ipBans)); banlistfile = Cvar_RegisterString("banlist_filename", "banlist.dat", CVAR_INIT, "Name of the file which holds the banlist"); ipbantime = Cvar_RegisterInt("banlist_maxipbantime", MAX_DEFAULT_IPBAN_MINUTES, 0, 20160, 0, "Limit of minutes to keep a ban against an ip-address up"); current_banlist_size = BANLIST_DEFAULT_SIZE; current_banindex = 0; banlist = realloc(NULL, current_banlist_size);//Test for NULL ? if(banlist){ SV_LoadBanlist(); }else{ Com_PrintError("Failed to allocate memory for the banlist. Banlist is disabled\n"); } }
void Init_CallVote(void){ g_votedMapName = Cvar_RegisterString("g_votedMapName", "", 0, "Contains the voted mapname"); g_votedGametype = Cvar_RegisterString("g_votedGametype", "", 0, "Contains the voted gametype"); g_voteTime = Cvar_RegisterInt("g_voteTime", 30, 10, 90, 0, "Duration a called vote is active"); g_voteBanTime = Cvar_RegisterInt("g_voteBanTime", 15, 1, 240, 0, "Duration a player is banned after successful votekick"); g_voteMaxVotes = Cvar_RegisterInt("g_voteMaxVotes", 2, 1, 10, 0, "How many votes a player can call"); g_voteVoteGametypes = Cvar_RegisterString("g_voteVoteGametypes", "", 0, "Contains a list of gametypes that are allowed to vote. Empty list = all"); g_voteKickMinPlayers = Cvar_RegisterInt("g_voteKickMinPlayers", 5, 0, 14, 0, "How many active players are needed on server to allow calling a kickvote"); g_voteAllowMaprotate = Cvar_RegisterBool("g_voteAllowMaprotate", qtrue, 0, "Allow calling map_rotate votes"); g_voteAllowKick = Cvar_RegisterBool("g_voteAllowKick", qtrue, 0, "Allow calling kick votes"); g_voteAllowGametype = Cvar_RegisterBool("g_voteAllowGametype", qtrue, 0, "Allow calling gametype votes"); g_voteAllowMap = Cvar_RegisterInt("g_voteAllowMap", 1, 0, 2, 0, "Allow calling next map setting votes - 0=disabled, 1=only from rotation, 2=Any map"); g_voteAllowRestart = Cvar_RegisterBool("g_voteAllowRestart", qtrue, 0, "Allow calling map restart votes"); g_voteFlags = 0; g_voteFlags |= g_voteAllowRestart->boolean ? VOTEFLAGS_RESTART : 0; g_voteFlags |= g_voteAllowGametype->boolean ? VOTEFLAGS_GAMETYPE : 0; g_voteFlags |= g_voteAllowMaprotate->boolean ? VOTEFLAGS_NEXTMAP : 0; g_voteFlags |= g_voteAllowMap->boolean && g_voteAllowGametype->boolean ? VOTEFLAGS_TYPE : 0; g_voteFlags |= g_voteAllowKick->boolean ? VOTEFLAGS_KICK : 0; g_voteFlags |= g_voteAllowMap->integer ? VOTEFLAGS_MAP : 0; g_voteFlags |= g_voteAllowMap->integer == 2 ? VOTEFLAGS_ANYMAP : 0; }
void GScr_MakeCvarServerInfo(void) { const char *var_name; cvar_t *var; const char *newstringval; signed int i; int num_args; char buffer_out[1024]; char buffer[1024]; var_name = Scr_GetString(0); var = Cvar_FindVar(var_name); if ( var ) { Cvar_AddFlags(var, 0x100u); return; } if ( Scr_GetType(1) == 3 ) { num_args = Scr_GetNumParam(); Scr_ConstructMessageString(1, num_args - 1, "Dvar Value", buffer, sizeof(buffer)); newstringval = buffer; } else { newstringval = Scr_GetString(1); } for(i = 0; i < sizeof(buffer) -1 && newstringval[i]; i++) { buffer_out[i] = I_CleanChar(newstringval[i]); if ( buffer_out[i] == '\"' ) buffer_out[i] = '\''; } buffer_out[i] = 0; Cvar_RegisterString(var_name, newstringval, 0x4100u, "Script defined user info cvar"); }
/* ================ Sys_Init ================ */ void Sys_Init() { Cvar_RegisterString("arch", OS_STRING "-" ARCH_STRING, CVAR_ROM, "System platform"); Cvar_RegisterString("username", Sys_GetUsername(), CVAR_ROM, "Current username"); }