]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_world.qc
Merge branch 'master' into terencehill/bot_waypoints
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_world.qc
index 42c64e6a33ece7333b8d557d27aa4a64d47f90bc..2812da09d08cd5b6e26a3c9407bc43d17bdf3a3b 100644 (file)
@@ -53,21 +53,21 @@ void PingPLReport_Think(entity this)
        this.nextthink = time + delta;
 
        e = edict_num(this.cnt + 1);
-       if(IS_REAL_CLIENT(e))
+       if(IS_CLIENT(e) && IS_REAL_CLIENT(e))
        {
                WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
                WriteByte(MSG_BROADCAST, this.cnt);
-               WriteShort(MSG_BROADCAST, bound(1, e.ping, 65535));
-               WriteByte(MSG_BROADCAST, min(ceil(e.ping_packetloss * 255), 255));
-               WriteByte(MSG_BROADCAST, min(ceil(e.ping_movementloss * 255), 255));
+               WriteShort(MSG_BROADCAST, bound(1, CS(e).ping, 65535));
+               WriteByte(MSG_BROADCAST, min(ceil(CS(e).ping_packetloss * 255), 255));
+               WriteByte(MSG_BROADCAST, min(ceil(CS(e).ping_movementloss * 255), 255));
 
                // record latency times for clients throughout the match so we can report it to playerstats
-               if(time > (e.latency_time + LATENCY_THINKRATE))
+               if(time > (CS(e).latency_time + LATENCY_THINKRATE))
                {
-                       e.latency_sum += e.ping;
-                       e.latency_cnt += 1;
-                       e.latency_time = time;
-                       //print("sum: ", ftos(e.latency_sum), ", cnt: ", ftos(e.latency_cnt), ", avg: ", ftos(e.latency_sum / e.latency_cnt), ".\n");
+                       CS(e).latency_sum += CS(e).ping;
+                       CS(e).latency_cnt += 1;
+                       CS(e).latency_time = time;
+                       //print("sum: ", ftos(CS(e).latency_sum), ", cnt: ", ftos(CS(e).latency_cnt), ", avg: ", ftos(CS(e).latency_sum / CS(e).latency_cnt), ".\n");
                }
        }
        else
@@ -253,6 +253,8 @@ void cvar_changes_init()
                // these can contain player IDs, so better hide
                BADPREFIX("g_forced_team_");
                BADCVAR("sv_muteban_list");
+               BADCVAR("sv_allow_customplayermodels_idlist");
+               BADCVAR("sv_allow_customplayermodels_speciallist");
 
                // mapinfo
                BADCVAR("fraglimit");
@@ -461,6 +463,7 @@ void cvar_changes_init()
                BADCVAR("teamplay_mode");
                BADCVAR("timelimit_override");
                BADPREFIX("g_warmup_");
+               BADPREFIX("sv_info_");
                BADPREFIX("sv_ready_restart_");
 
                // mutators that announce themselves properly to the server browser
@@ -1327,8 +1330,8 @@ void IntermissionThink(entity this)
 {
        FixIntermissionClient(this);
 
-       float server_screenshot = (autocvar_sv_autoscreenshot && this.cvar_cl_autoscreenshot);
-       float client_screenshot = (this.cvar_cl_autoscreenshot == 2);
+       float server_screenshot = (autocvar_sv_autoscreenshot && CS(this).cvar_cl_autoscreenshot);
+       float client_screenshot = (CS(this).cvar_cl_autoscreenshot == 2);
 
        if( (server_screenshot || client_screenshot)
                && ((this.autoscreenshot > 0) && (time > this.autoscreenshot)) )
@@ -1456,9 +1459,9 @@ void DumpStats(float final)
        if(to_file)
                fputs(file, strcat(s, "\n"));
 
-       FOREACH_CLIENT(IS_REAL_CLIENT(it) || (IS_BOT_CLIENT(it) && autocvar_sv_logscores_bots), LAMBDA(
+       FOREACH_CLIENT(IS_REAL_CLIENT(it) || (IS_BOT_CLIENT(it) && autocvar_sv_logscores_bots), {
                s = strcat(":player:see-labels:", GetPlayerScoreString(it, 0), ":");
-               s = strcat(s, ftos(rint(time - it.jointime)), ":");
+               s = strcat(s, ftos(rint(time - CS(it).jointime)), ":");
                if(IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it))
                        s = strcat(s, ftos(it.team), ":");
                else
@@ -1470,7 +1473,7 @@ void DumpStats(float final)
                        GameLogEcho(strcat(s, ftos(it.playerid), ":", playername(it, false)));
                if(to_file)
                        fputs(file, strcat(s, playername(it, false), "\n"));
-       ));
+       });
 
        if(teamplay)
        {
@@ -1527,9 +1530,9 @@ void FixIntermissionClient(entity e)
                {
                        stuffcmd(e, "\nscr_printspeed 1000000\n");
                        RandomSelection_Init();
-                       FOREACH_WORD(autocvar_sv_intermission_cdtrack, true, LAMBDA(
+                       FOREACH_WORD(autocvar_sv_intermission_cdtrack, true, {
                                RandomSelection_AddString(it, 1, 1);
-                       ));
+                       });
                        if (RandomSelection_chosen_string != "")
                        {
                                stuffcmd(e, sprintf("\ncd loop %s\n", RandomSelection_chosen_string));
@@ -1579,11 +1582,11 @@ void NextLevel()
 
        GameLogClose();
 
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                FixIntermissionClient(it);
                if(it.winning)
                        bprint(playername(it, false), " ^7wins.\n");
-       ));
+       });
 
        target_music_kill();
 
@@ -1595,25 +1598,6 @@ void NextLevel()
        localcmd("\nsv_hook_gameend\n");
 }
 
-/*
-============
-CheckRules_Player
-
-Exit deathmatch games upon conditions
-============
-*/
-void CheckRules_Player(entity this)
-{
-       if (game_stopped) // someone else quit the game already
-               return;
-
-       if(!IS_DEAD(this))
-               this.play_time += frametime;
-
-       // fixme: don't check players; instead check spawnfunc_dom_team and spawnfunc_ctf_team entities
-       //   (div0: and that in CheckRules_World please)
-}
-
 
 float InitiateSuddenDeath()
 {
@@ -1676,22 +1660,22 @@ float GetWinningCode(float fraglimitreached, float equality)
 // set the .winning flag for exactly those players with a given field value
 void SetWinners(.float field, float value)
 {
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.winning = (it.(field) == value)));
+       FOREACH_CLIENT(IS_PLAYER(it), { it.winning = (it.(field) == value); });
 }
 
 // set the .winning flag for those players with a given field value
 void AddWinners(.float field, float value)
 {
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it), {
                if(it.(field) == value)
                        it.winning = 1;
-       ));
+       });
 }
 
 // clear the .winning flags
 void ClearWinners()
 {
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.winning = 0));
+       FOREACH_CLIENT(IS_PLAYER(it), { it.winning = 0; });
 }
 
 void ShuffleMaplist()
@@ -1784,7 +1768,7 @@ float WinningCondition_RanOutOfSpawns()
 
        team1_score = team2_score = team3_score = team4_score = 0;
 
-       FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), LAMBDA(
+       FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), {
                switch(it.team)
                {
                        case NUM_TEAM_1: team1_score = 1; break;
@@ -1792,7 +1776,7 @@ float WinningCondition_RanOutOfSpawns()
                        case NUM_TEAM_3: team3_score = 1; break;
                        case NUM_TEAM_4: team4_score = 1; break;
                }
-       ));
+       });
 
        IL_EACH(g_spawnpoints, true,
        {
@@ -1918,13 +1902,13 @@ void CheckRules_World()
                                float playerswithlaps;
                                float readyplayers;
                                totalplayers = playerswithlaps = readyplayers = 0;
-                               FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+                               FOREACH_CLIENT(IS_PLAYER(it), {
                                        ++totalplayers;
                                        if(PlayerScore_Add(it, SP_RACE_FASTEST, 0))
                                                ++playerswithlaps;
                                        if(it.ready)
                                                ++readyplayers;
-                               ));
+                               });
 
                                // at least 2 of the players have completed a lap: start the RACE
                                // otherwise, the players should end the qualifying on their own
@@ -2144,7 +2128,7 @@ float RedirectionThink()
        redirection_nextthink = time + 1;
 
        clients_found = 0;
-       FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+       FOREACH_CLIENT(IS_REAL_CLIENT(it), {
                // TODO add timer
                LOG_INFO("Redirecting: sending connect command to ", it.netname, "\n");
                if(redirection_target == "self")
@@ -2152,7 +2136,7 @@ float RedirectionThink()
                else
                        stuffcmd(it, strcat("\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " \"connect ", redirection_target, "\"\n"));
                ++clients_found;
-       ));
+       });
 
        LOG_INFO("Redirecting: ", ftos(clients_found), " clients left.\n");