]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_world.qc
Minor performance tweak
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_world.qc
index c57d545debcd0563b650bfd5784176fe580ef02f..f1154e1b59539c66039e39b3b4373aafd25a2f3f 100644 (file)
@@ -34,6 +34,7 @@
 #include "../common/util.qh"
 #include "../common/items/all.qh"
 #include "../common/weapons/all.qh"
+#include "../common/state.qh"
 
 const float LATENCY_THINKRATE = 10;
 .float latency_sum;
@@ -80,8 +81,7 @@ void PingPLReport_Think()
 }
 void PingPLReport_Spawn()
 {
-       pingplreport = new(pingplreport);
-       make_pure(pingplreport);
+       pingplreport = new_pure(pingplreport);
        pingplreport.think = PingPLReport_Think;
        pingplreport.nextthink = time;
 }
@@ -232,7 +232,6 @@ void cvar_changes_init()
                BADPREFIX("g_chat_flood_");
                BADPREFIX("g_ghost_items");
                BADPREFIX("g_playerstats_");
-               BADPREFIX("g_respawn_ghosts");
                BADPREFIX("g_voice_flood_");
                BADPREFIX("log_file");
                BADPREFIX("rcon_");
@@ -339,6 +338,7 @@ void cvar_changes_init()
                BADPREFIX("g_ctf_captimerecord_");
                BADPREFIX("g_maplist_votable_");
                BADPREFIX("g_mod_");
+               BADPREFIX("g_respawn_");
                BADPREFIX("net_");
                BADPREFIX("prvm_");
                BADPREFIX("skill_");
@@ -523,8 +523,7 @@ void RandomSeed_Think()
 }
 void RandomSeed_Spawn()
 {SELFPARAM();
-       randomseed = new(randomseed);
-       make_pure(randomseed);
+       randomseed = new_pure(randomseed);
        randomseed.think = RandomSeed_Think;
        Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
 
@@ -1505,6 +1504,7 @@ only called if a time or frag limit has expired
 */
 void NextLevel()
 {
+    SELFPARAM();
        gameover = true;
 
        intermission_running = 1;
@@ -1970,40 +1970,36 @@ string GotoMap(string m)
 
 
 void EndFrame()
-{SELFPARAM();
+{
        anticheat_endframe();
 
-       float altime;
-       FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+       FOREACH_CLIENT(IS_REAL_CLIENT(it), {
                entity e = IS_SPEC(it) ? it.enemy : it;
-               if(e.typehitsound)
+               if (e.typehitsound) {
                        it.typehit_time = time;
-               else if(e.damage_dealt)
-               {
+               } else if (e.damage_dealt) {
                        it.hit_time = time;
                        it.damage_dealt_total += ceil(e.damage_dealt);
                }
-       ));
-       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
        // 1 frame of lag (cl_nolerp 0). The last +1 however should not be
        // needed!
-       FOREACH_CLIENT(true, LAMBDA(
+       float altime = time + frametime * (1 + autocvar_g_antilag_nudge);
+       FOREACH_CLIENT(true, {
                it.typehitsound = false;
                it.damage_dealt = 0;
-               setself(it);
-               antilag_record(it, altime);
-       ));
-       FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA(
-               setself(it);
-               antilag_record(it, altime);
-       ));
-       FOREACH_CLIENT(PS(it), LAMBDA(
+               antilag_record(it, CS(it), altime);
+       });
+       FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
+               antilag_record(it, it, altime);
+       });
+       FOREACH_CLIENT(PS(it), {
                PlayerState s = PS(it);
                s.ps_push(s, it);
-       ));
+       });
 }