void SetDefaultAlpha()
{
- if(cvar("g_running_guns"))
+ if(autocvar_g_running_guns)
{
default_player_alpha = -1;
default_weapon_alpha = +1;
}
else if(g_cloaked)
{
- default_player_alpha = cvar("g_balance_cloaked_alpha");
+ default_player_alpha = autocvar_g_balance_cloaked_alpha;
default_weapon_alpha = default_player_alpha;
}
else
{
- default_player_alpha = cvar("g_player_alpha");
+ default_player_alpha = autocvar_g_player_alpha;
if(default_player_alpha == 0)
default_player_alpha = 1;
default_weapon_alpha = default_player_alpha;
{
float a, b;
- if(!cvar("developer_fteqccbugs"))
+ if(!autocvar_developer_fteqccbugs)
return;
dprint("*** fteqcc test: checking for bugs...\n");
centerprint_atprio(plr, CENTERPRIO_SPAM, timeStr);
}
}
- if(remainingTimeoutTime == cvar("sv_timeout_resumetime")) { //play a warning sound when only <sv_timeout_resumetime> seconds are left
+ if(remainingTimeoutTime == autocvar_sv_timeout_resumetime) { //play a warning sound when only <sv_timeout_resumetime> seconds are left
Announce("prepareforbattle");
}
remainingTimeoutTime -= 1;
void GotoFirstMap()
{
float n;
- if(cvar("_sv_init"))
+ if(autocvar__sv_init)
{
// cvar_set("_sv_init", "0");
// we do NOT set this to 0 any more, so someone "accidentally" changing
// to this "init" map on a dedicated server will cause no permanent
// harm
- if(cvar("g_maplist_shuffle"))
+ if(autocvar_g_maplist_shuffle)
ShuffleMaplist();
- n = tokenizebyseparator(cvar_string("g_maplist"), " ");
+ n = tokenizebyseparator(autocvar_g_maplist, " ");
cvar_set("g_maplist_index", ftos(n - 1)); // jump to map 0 in GotoNextMap
MapInfo_Enumerate();
BADCVAR("sv_vote_simple_majority_factor");
BADCVAR("timelimit_override");
- if(cvar("g_minstagib"))
+ if(autocvar_g_minstagib)
{
BADCVAR("g_grappling_hook");
BADCVAR("g_jetpack");
TemporaryDB = db_create();
- /*
- TODO sound pack system
- // initialize sound pack system
- soundpack = cvar_string("g_soundpack");
- if(soundpack != "")
- soundpack = strcat(soundpack, "/");
- soundpack = strzone(soundpack);
- */
-
// 0 normal
lightstyle(0, "m");
// 63 testing
lightstyle(63, "a");
- if(cvar("g_campaign"))
+ if(autocvar_g_campaign)
CampaignPreInit();
Map_MarkAsRecent(mapname);
LaserInit();
player_count = 0;
- bot_waypoints_for_items = cvar("g_waypoints_for_items");
+ bot_waypoints_for_items = autocvar_g_waypoints_for_items;
if(bot_waypoints_for_items == 1)
if(self.spawnflags & SPAWNFLAG_NO_WAYPOINTS_FOR_ITEMS)
bot_waypoints_for_items = 0;
// for setting by mapinfo
- q3acompat_machineshotgunswap = cvar("sv_q3acompat_machineshotgunswap");
+ q3acompat_machineshotgunswap = autocvar_sv_q3acompat_machineshotgunswap;
cvar_set("sv_q3acompat_machineshotgunswap", "0");
precache();
// dom_init();
GameLogInit(); // prepare everything
- if(cvar("sv_eventlog"))
+ if(autocvar_sv_eventlog)
{
- s = strcat(cvar_string("sv_eventlog_files_counter"), ".");
+ s = strcat(ftos(autocvar_sv_eventlog_files_counter), ".");
s = strcat(s, ftos(random()));
matchid = strzone(s);
s = ret_string;
// simple, probably not good in the mutator system
- if(cvar("g_grappling_hook"))
+ if(autocvar_g_grappling_hook)
s = strcat(s, ":grappling_hook");
// initialiation stuff, not good in the mutator system
- if(!cvar("g_use_ammunition"))
+ if(!autocvar_g_use_ammunition)
s = strcat(s, ":no_use_ammunition");
// initialiation stuff, not good in the mutator system
- if(!cvar("g_pickup_items"))
+ if(!autocvar_g_pickup_items)
s = strcat(s, ":no_pickup_items");
// initialiation stuff, not good in the mutator system
- if(cvar_string("g_weaponarena") != "0")
- s = strcat(s, ":", cvar_string("g_weaponarena"), " arena");
+ if(autocvar_g_weaponarena != "0")
+ s = strcat(s, ":", autocvar_g_weaponarena, " arena");
// TODO to mutator system
- if(cvar("g_norecoil"))
+ if(autocvar_g_norecoil)
s = strcat(s, ":norecoil");
// TODO to mutator system
- if(cvar("g_midair"))
+ if(autocvar_g_midair)
s = strcat(s, ":midair");
// TODO to mutator system
- if(cvar("g_minstagib"))
+ if(autocvar_g_minstagib)
s = strcat(s, ":minstagib");
GameLogEcho(s);
SetDefaultAlpha();
- if(cvar("g_campaign"))
+ if(autocvar_g_campaign)
CampaignPostInit();
fteqcc_testbugs();
addstat(STAT_INVINCIBLE_FINISHED, AS_FLOAT, invincible_finished);
addstat(STAT_PRESSED_KEYS, AS_FLOAT, pressedkeys);
addstat(STAT_FUEL, AS_INT, ammo_fuel);
- addstat(STAT_DAMAGE_HITS, AS_INT, stat_hit);
- addstat(STAT_DAMAGE_FIRED, AS_INT, stat_fired);
addstat(STAT_SHOTORG, AS_INT, stat_shotorg);
addstat(STAT_LEADLIMIT, AS_FLOAT, stat_leadlimit);
addstat(STAT_BULLETS_LOADED, AS_INT, campingrifle_bulletcounter);
addstat(STAT_LAST_PICKUP, AS_FLOAT, last_pickup);
addstat(STAT_NEX_CHARGE, AS_FLOAT, nex_charge);
- addstat(STAT_NEX_CHARGEPOOL, AS_FLOAT, nex_charge_pool_ammo);
+ addstat(STAT_NEX_CHARGEPOOL, AS_FLOAT, nex_chargepool_ammo);
- if(g_ca)
+ if(g_ca || g_freezetag)
{
addstat(STAT_REDALIVE, AS_INT, redalive_stat);
addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat);
+ addstat(STAT_YELLOWALIVE, AS_INT, yellowalive_stat);
+ addstat(STAT_PINKALIVE, AS_INT, pinkalive_stat);
+ }
+ if(g_freezetag)
+ {
+ addstat(STAT_FROZEN, AS_INT, freezetag_frozen);
+ addstat(STAT_REVIVE_PROGRESS, AS_FLOAT, freezetag_revive_progress);
}
+
// g_movementspeed hack
addstat(STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW, AS_FLOAT, stat_sv_airspeedlimit_nonqw);
addstat(STAT_MOVEVARS_MAXSPEED, AS_FLOAT, stat_sv_maxspeed);
lsnewmaps_reply = strzone(strcat(lsnewmaps_reply, "\n"));
maplist_reply = "^7Maps in list: ";
- n = tokenize_console(cvar_string("g_maplist"));
+ n = tokenize_console(autocvar_g_maplist);
for(i = 0, j = 0; i < n; ++i)
{
if(MapInfo_CheckMap(argv(i)))
localcmd("\n_sv_hook_gamestart ", GetGametype(), "\n");
// fill sv_curl_serverpackages from .serverpackage files
- if(cvar("sv_curl_serverpackages_auto"))
+ if(autocvar_sv_curl_serverpackages_auto)
{
fd = search_begin("*.serverpackage", TRUE, FALSE);
s = "";
cvar_set("sv_curl_serverpackages", substring(s, 1, -1));
}
+ PlayerStats_Init();
+
world_initialized = 1;
}
string map;
map = GetMapname();
- idx = cvar("g_maplist_index");
+ idx = autocvar_g_maplist_index;
if(idx >= 0)
if(idx < Map_Count)
float MapHasRightSize(string map)
{
float fh;
- if(currentbots || cvar("bot_number") || player_count < cvar("minplayers"))
- if(cvar("g_maplist_check_waypoints"))
+ if(currentbots || autocvar_bot_number || player_count < autocvar_minplayers)
+ if(autocvar_g_maplist_check_waypoints)
{
dprint("checkwp "); dprint(map);
fh = fopen(strcat("maps/", map, ".waypoints"), FILE_READ);
void Map_MarkAsRecent(string m)
{
- cvar_set("g_maplist_mostrecent", strwords(strcat(m, " ", cvar_string("g_maplist_mostrecent")), max(0, cvar("g_maplist_mostrecent_count"))));
+ cvar_set("g_maplist_mostrecent", strwords(strcat(m, " ", autocvar_g_maplist_mostrecent), max(0, autocvar_g_maplist_mostrecent_count)));
}
float Map_IsRecent(string m)
{
- return strhasword(cvar_string("g_maplist_mostrecent"), m);
+ return strhasword(autocvar_g_maplist_mostrecent, m);
}
float Map_Check(float position, float pass)
newlist = strcat(newlist, " ", argv(j));
newlist = substring(newlist, 1, strlen(newlist) - 1);
cvar_set("g_maplist", newlist);
- Map_Count = tokenizebyseparator(cvar_string("g_maplist"), " ");
+ Map_Count = tokenizebyseparator(autocvar_g_maplist, " ");
// NOTE: the selected map has just been inserted at (insertpos-1)th position
Map_Current = insertpos - 1; // this is not really valid, but this way the fallback has a chance of working
void Maplist_Init()
{
- Map_Count = tokenizebyseparator(cvar_string("g_maplist"), " ");
+ Map_Count = tokenizebyseparator(autocvar_g_maplist, " ");
if(Map_Count == 0)
{
bprint( "Maplist is empty! Resetting it to default map list.\n" );
cvar_set("g_maplist", MapInfo_ListAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags()));
- if(cvar("g_maplist_shuffle"))
+ if(autocvar_g_maplist_shuffle)
ShuffleMaplist();
localcmd("\nmenu_cmd sync\n");
- Map_Count = tokenizebyseparator(cvar_string("g_maplist"), " ");
+ Map_Count = tokenizebyseparator(autocvar_g_maplist, " ");
}
if(Map_Count == 0)
error("empty maplist, cannot select a new map");
nextMap = -1;
if(nextMap == -1)
- if(cvar("g_maplist_shuffle") > 0)
- nextMap = MaplistMethod_Shuffle(cvar("g_maplist_shuffle") + 1);
+ if(autocvar_g_maplist_shuffle > 0)
+ nextMap = MaplistMethod_Shuffle(autocvar_g_maplist_shuffle + 1);
if(nextMap == -1)
- if(cvar("g_maplist_selectrandom"))
+ if(autocvar_g_maplist_selectrandom)
nextMap = MaplistMethod_Random();
if(nextMap == -1)
float DoNextMapOverride()
{
- if(cvar("g_campaign"))
+ if(autocvar_g_campaign)
{
CampaignPostIntermission();
alreadychangedlevel = TRUE;
return TRUE;
}
- if(cvar("quit_when_empty"))
+ if(autocvar_quit_when_empty)
{
if(player_count <= currentbots)
{
return TRUE;
}
}
- if(cvar_string("quit_and_redirect") != "")
+ if(autocvar_quit_and_redirect != "")
{
- redirection_target = strzone(cvar_string("quit_and_redirect"));
+ redirection_target = strzone(autocvar_quit_and_redirect);
alreadychangedlevel = TRUE;
return TRUE;
}
- if (cvar("samelevel")) // if samelevel is set, stay on same level
+ if (autocvar_samelevel) // if samelevel is set, stay on same level
{
// this does not work because it tries to exec maps/nexdm01.mapcfg (which doesn't exist, it should be trying maps/dm_nexdm01.mapcfg for example)
//localcmd(strcat("exec \"maps/", mapname, ".mapcfg\"\n"));
alreadychangedlevel = TRUE;
return TRUE;
}
- if(cvar_string("nextmap") != "")
- if(MapInfo_CheckMap(cvar_string("nextmap")))
+ if(autocvar_nextmap != "")
+ if(MapInfo_CheckMap(autocvar_nextmap))
{
- Map_Goto_SetStr(cvar_string("nextmap"));
+ Map_Goto_SetStr(autocvar_nextmap);
Map_Goto();
alreadychangedlevel = TRUE;
return TRUE;
}
- if(cvar("lastlevel"))
+ if(autocvar_lastlevel)
{
GameResetCfg();
localcmd("set lastlevel 0\ntogglemenu\n");
{
bprint( "Maplist contains no single playable map! Resetting it to default map list.\n" );
cvar_set("g_maplist", MapInfo_ListAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags()));
- if(cvar("g_maplist_shuffle"))
+ if(autocvar_g_maplist_shuffle)
ShuffleMaplist();
localcmd("\nmenu_cmd sync\n");
}
{
FixIntermissionClient(self);
- if(cvar("sv_autoscreenshot"))
+ if(autocvar_sv_autoscreenshot)
if(self.autoscreenshot > 0)
if(time > self.autoscreenshot)
{
void DumpStats(float final)
{
- local float file;
- local string s;
- local float to_console;
- local float to_eventlog;
- local float to_file;
- local float i;
+ float file;
+ string s;
+ float to_console;
+ float to_eventlog;
+ float to_file;
+ float i;
+ entity e;
- to_console = cvar("sv_logscores_console");
- to_eventlog = cvar("sv_eventlog");
- to_file = cvar("sv_logscores_file");
+ to_console = autocvar_sv_logscores_console;
+ to_eventlog = autocvar_sv_eventlog;
+ to_file = autocvar_sv_logscores_file;
if(!final)
{
}
if(to_eventlog)
- if(cvar("sv_eventlog_console"))
+ if(autocvar_sv_eventlog_console)
to_console = FALSE; // otherwise we get the output twice
if(final)
GameLogEcho(s);
if(to_file)
{
- file = fopen(cvar_string("sv_logscores_filename"), FILE_APPEND);
+ file = fopen(autocvar_sv_logscores_filename, FILE_APPEND);
if(file == -1)
to_file = FALSE;
else
FOR_EACH_CLIENT(other)
{
- if ((clienttype(other) == CLIENTTYPE_REAL) || (clienttype(other) == CLIENTTYPE_BOT && cvar("sv_logscores_bots")))
+ if ((clienttype(other) == CLIENTTYPE_REAL) || (clienttype(other) == CLIENTTYPE_BOT && autocvar_sv_logscores_bots))
{
s = strcat(":player:see-labels:", GetPlayerScoreString(other, 0), ":");
s = strcat(s, ftos(rint(time - other.jointime)), ":");
fputs(file, ":end\n");
fclose(file);
}
+
+ // send statistics
+ FOR_EACH_CLIENT(e)
+ PlayerStats_AddGlobalInfo(e);
+ PlayerStats_Shutdown();
}
void FixIntermissionClient(entity e)
if(clienttype(e) == CLIENTTYPE_REAL)
{
stuffcmd(e, "\nscr_printspeed 1000000\n");
- s = cvar_string("sv_intermission_cdtrack");
+ s = autocvar_sv_intermission_cdtrack;
if(s != "")
stuffcmd(e, strcat("\ncd loop ", s, "\n"));
msg_entity = e;
*/
void NextLevel()
{
- float i;
-
gameover = TRUE;
intermission_running = 1;
// enforce a wait time before allowing changelevel
if(player_count > 0)
- intermission_exittime = time + cvar("sv_mapchange_delay");
+ intermission_exittime = time + autocvar_sv_mapchange_delay;
else
intermission_exittime = -1;
DumpStats(TRUE);
- if(cvar("sv_eventlog"))
+ if(autocvar_sv_eventlog)
GameLogEcho(":gameover");
GameLogClose();
-// TO DO
-
-// save the stats to a text file on the client
-// stuffcmd(other, log_stats "stats/file_name");
-// bprint stats
-// stuffcmd(other, log_stats "");
-// use a filename similar to the demo name
- // string file_name;
- // file_name = strcat("\nlog_file \"stats/", strftime(TRUE, "%Y-%m-%d_%H-%M"), "_", mapname, ".txt\""); // open the log file
-
-// write a stats parser for the menu
-
- if(cvar("sv_accuracy_data_send")) {
- string stats_to_send;
-
- FOR_EACH_CLIENT(other) { // make the string to send
- FixIntermissionClient(other);
-
- if(other.cvar_cl_accuracy_data_share) {
- stats_to_send = strcat(stats_to_send, ":hits:", other.netname);
-
- for(i = WEP_FIRST; i <= WEP_LAST; ++i)
- stats_to_send = strcat(stats_to_send, ":", ftos(other.stats_hit[i-1]));
-
- stats_to_send = strcat(stats_to_send, "\n:fired:", other.netname);
-
- for(i = WEP_FIRST; i <= WEP_LAST; ++i)
- stats_to_send = strcat(stats_to_send, ":", ftos(other.stats_fired[i-1]));
-
- stats_to_send = strcat(stats_to_send, "\n");
- }
- }
-
- FOR_EACH_REALCLIENT(other) { // only spam humans
- Score_NicePrint(other); // print the score
-
- if(other.cvar_cl_accuracy_data_receive) // send the stats string to all the willing clients
- bprint(stats_to_send);
- }
- } else { // ye olde message
- FOR_EACH_PLAYER(other) {
- FixIntermissionClient(other);
-
- if(other.winning)
- bprint(other.netname, " ^7wins.\n");
- }
+ FOR_EACH_PLAYER(other) {
+ FixIntermissionClient(other);
+ if(other.winning)
+ bprint(other.netname, " ^7wins.\n");
}
- if(cvar("g_campaign"))
+ if(autocvar_g_campaign)
CampaignPreIntermission();
localcmd("\nsv_hook_gameend\n");
// - for this timelimit_overtime needs to be >0 of course
// - also check the winning condition calculated in the previous frame and only add normal overtime
// again, if at the point at which timelimit would be extended again, still no winner was found
- if ((checkrules_overtimesadded >= 0) && (checkrules_overtimesadded < cvar("timelimit_overtimes")) && cvar("timelimit_overtime") && !(g_race && !g_race_qualifying))
+ if ((checkrules_overtimesadded >= 0) && (checkrules_overtimesadded < autocvar_timelimit_overtimes) && autocvar_timelimit_overtime && !(g_race && !g_race_qualifying))
{
return 1; // need to call InitiateOvertime later
}
{
if(!checkrules_suddendeathend)
{
- checkrules_suddendeathend = time + 60 * cvar("timelimit_suddendeath");
+ checkrules_suddendeathend = time + 60 * autocvar_timelimit_suddendeath;
if(g_race && !g_race_qualifying)
race_StartCompleting();
}
++checkrules_overtimesadded;
//add one more overtime by simply extending the timelimit
float tl;
- tl = cvar("timelimit");
- tl += cvar("timelimit_overtime");
+ tl = autocvar_timelimit;
+ tl += autocvar_timelimit_overtime;
cvar_set("timelimit", ftos(tl));
string minutesPlural;
- if (cvar("timelimit_overtime") == 1)
+ if (autocvar_timelimit_overtime == 1)
minutesPlural = " ^3minute";
else
minutesPlural = " ^3minutes";
bcenterprint(
strcat(
"^3Now playing ^1OVERTIME^3!\n\n^3Added ^1",
- ftos(cvar("timelimit_overtime")),
+ ftos(autocvar_timelimit_overtime),
minutesPlural,
" to the game!"
)
float GetWinningCode(float fraglimitreached, float equality)
{
- if(cvar("g_campaign") == 1)
+ if(autocvar_g_campaign == 1)
if(fraglimitreached)
return WINNING_YES;
else
float LMS_NewPlayerLives()
{
float fl;
- fl = cvar("fraglimit");
+ fl = autocvar_fraglimit;
if(fl == 0)
fl = 999;
if(lms_lowest_lives < 1)
return 0;
- if(!cvar("g_lms_join_anytime"))
- if(lms_lowest_lives < fl - cvar("g_lms_last_join"))
+ if(!autocvar_g_lms_join_anytime)
+ if(lms_lowest_lives < fl - autocvar_g_lms_last_join)
return 0;
return bound(1, lms_lowest_lives, fl);
TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 666 - TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 0));
- if(ent.cnt == 1 || cvar("g_campaign")) // this was the second round
+ if(ent.cnt == 1 || autocvar_g_campaign) // this was the second round
{
status = WINNING_YES;
}
void ShuffleMaplist()
{
- cvar_set("g_maplist", shufflewords(cvar_string("g_maplist")));
+ cvar_set("g_maplist", shufflewords(autocvar_g_maplist));
}
float leaderfrags;
{
float leadlimitreached;
leadlimitreached = (WinningConditionHelper_topscore - WinningConditionHelper_secondscore >= leadlimit);
- if(cvar("leadlimit_and_fraglimit"))
+ if(autocvar_leadlimit_and_fraglimit)
limitreached = (limitreached && leadlimitreached);
else
limitreached = (limitreached || leadlimitreached);
return;
}
- timelimit = cvar("timelimit") * 60;
- fraglimit = cvar("fraglimit");
- leadlimit = cvar("leadlimit");
+ timelimit = autocvar_timelimit * 60;
+ fraglimit = autocvar_fraglimit;
+ leadlimit = autocvar_leadlimit;
if(inWarmupStage || time <= game_starttime) // NOTE: this is <= to prevent problems in the very tic where the game starts
{
float i;
if(m == "")
return "That's not how to use this command.";
- if(!cvar("g_maplist_votable_suggestions"))
+ if(!autocvar_g_maplist_votable_suggestions)
return "Suggestions are not accepted on this server.";
if(mapvote_initialized)
return "Can't suggest - voting is already in progress!";
m = MapInfo_FixName(m);
if(!m)
return "The map you suggested is not available on this server.";
- if(!cvar("g_maplist_votable_suggestions_override_mostrecent"))
+ if(!autocvar_g_maplist_votable_suggestions_override_mostrecent)
if(Map_IsRecent(m))
return "This server does not allow for recent maps to be played again. Please be patient for some rounds.";
if(mapvote_suggestions[i] != "")
strunzone(mapvote_suggestions[i]);
mapvote_suggestions[i] = strzone(m);
- if(cvar("sv_eventlog"))
+ if(autocvar_sv_eventlog)
GameLogEcho(strcat(":vote:suggested:", m, ":", ftos(self.playerid)));
return strcat("Suggestion of ", m, " accepted.");
}
MapVote_ClearAllVotes();
mapvote_count = 0;
- mapvote_detail = !cvar("g_maplist_votable_nodetail");
- mapvote_abstain = cvar("g_maplist_votable_abstain");
+ mapvote_detail = !autocvar_g_maplist_votable_nodetail;
+ mapvote_abstain = autocvar_g_maplist_votable_abstain;
if(mapvote_abstain)
- nmax = min(MAPVOTE_COUNT - 1, cvar("g_maplist_votable"));
+ nmax = min(MAPVOTE_COUNT - 1, autocvar_g_maplist_votable);
else
- nmax = min(MAPVOTE_COUNT, cvar("g_maplist_votable"));
- smax = min3(nmax, cvar("g_maplist_votable_suggestions"), mapvote_suggestion_ptr);
+ nmax = min(MAPVOTE_COUNT, autocvar_g_maplist_votable);
+ smax = min3(nmax, autocvar_g_maplist_votable_suggestions, mapvote_suggestion_ptr);
// we need this for AddVotable, as that cycles through the screenshot dirs
- mapvote_screenshot_dirs_count = tokenize_console(cvar_string("g_maplist_votable_screenshot_dir"));
+ mapvote_screenshot_dirs_count = tokenize_console(autocvar_g_maplist_votable_screenshot_dir);
if(mapvote_screenshot_dirs_count == 0)
mapvote_screenshot_dirs_count = tokenize_console("maps levelshots");
mapvote_screenshot_dirs_count = min(mapvote_screenshot_dirs_count, MAPVOTE_SCREENSHOT_DIRS_COUNT);
{
bprint( "Maplist contains no single playable map! Resetting it to default map list.\n" );
cvar_set("g_maplist", MapInfo_ListAllowedMaps(MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags()));
- if(cvar("g_maplist_shuffle"))
+ if(autocvar_g_maplist_shuffle)
ShuffleMaplist();
localcmd("\nmenu_cmd sync\n");
for(i = 0; i < 100 && mapvote_count < nmax; ++i)
//dprint("mapvote count is ", ftos(mapvote_count), "\n");
- mapvote_keeptwotime = time + cvar("g_maplist_votable_keeptwotime");
- mapvote_timeout = time + cvar("g_maplist_votable_timeout");
+ mapvote_keeptwotime = time + autocvar_g_maplist_votable_keeptwotime;
+ mapvote_timeout = time + autocvar_g_maplist_votable_timeout;
if(mapvote_count_real < 3 || mapvote_keeptwotime <= time)
mapvote_keeptwotime = 0;
mapvote_message = "Choose a map and press its key!";
float i;
float didntvote;
- if(cvar("sv_eventlog"))
+ if(autocvar_sv_eventlog)
{
result = strcat(":vote:finished:", mapvote_maps[mappos]);
result = strcat(result, ":", ftos(mapvote_votes[mappos]), "::");
}
}
result = strcat(result, ":didn't vote:", ftos(didntvote));
- if(cvar("sv_eventlog"))
+ if(autocvar_sv_eventlog)
GameLogEcho(result);
}
if(mapvote_run)
return;
+ // wait for stats to be sent first
+ if(!playerstats_waitforme)
+ return;
+
MapInfo_Enumerate();
if(MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 1))
mapvote_run = TRUE;
if(!mapvote_initialized)
{
- if(cvar("rescan_pending") == 1)
+ if(autocvar_rescan_pending == 1)
{
cvar_set("rescan_pending", "2");
localcmd("fs_rescan\nrescan_pending 3\n");
return;
}
- else if(cvar("rescan_pending") == 2)
+ else if(autocvar_rescan_pending == 2)
{
return;
}
- else if(cvar("rescan_pending") == 3)
+ else if(autocvar_rescan_pending == 3)
{
// now build missing mapinfo files
if(!MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 1))
mapvote_initialized = TRUE;
if(DoNextMapOverride())
return;
- if(!cvar("g_maplist_votable") || player_count <= 0)
+ if(!autocvar_g_maplist_votable || player_count <= 0)
{
GotoNextMap();
return;
play2(self, "misc/hit.wav");
}
}
- altime = time + frametime * (1 + cvar("g_antilag_nudge"));
+ altime = time + frametime * (1 + autocvar_g_antilag_nudge);
// add 1 frametime because after this, engine SV_Physics
// increases time by a frametime and then networks the frame
// add another frametime because client shows everything with
void SV_Shutdown()
{
+ entity e;
+
if(gameover > 1) // shutting down already?
return;
world_initialized = 0;
print("Saving persistent data...\n");
Ban_SaveBans();
+
+ FOR_EACH_CLIENT(e)
+ PlayerStats_AddGlobalInfo(e);
+ PlayerStats_Shutdown();
+
if(!cheatcount_total)
{
- if(cvar("sv_db_saveasdump"))
+ if(autocvar_sv_db_saveasdump)
db_dump(ServerProgsDB, "server.db");
else
db_save(ServerProgsDB, "server.db");
}
- if(cvar("developer"))
+ if(autocvar_developer)
{
- if(cvar("sv_db_saveasdump"))
+ if(autocvar_sv_db_saveasdump)
db_dump(TemporaryDB, "server-temp.db");
else
db_save(TemporaryDB, "server-temp.db");