]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/view.qc
Limit sendcvar calls to one per frame
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / view.qc
index a7449494f60a4a3afa49b70321ff07699a3e2872..ac4d13a6e906d46a292864674ca2ba9bb5255207 100644 (file)
@@ -1541,7 +1541,6 @@ float oldr_useinfinitefarclip;
 float prev_myteam;
 int lasthud;
 float vh_notice_time;
-float ReplicateVars_time;
 void CSQC_UpdateView(entity this, float w, float h)
 {
        TC(int, w); TC(int, h);
@@ -1568,11 +1567,9 @@ void CSQC_UpdateView(entity this, float w, float h)
        // TODO remove references to sendcvar from cvar descriptions
        // TODO stop server from requesting cvar values to the client on connection as it's no longer necessary
 
-       if (time > ReplicateVars_time) // prevents network spam
-       {
-               ReplicateVars(false);
-               ReplicateVars_time = time + 0.8 + random() * 0.4;
-       }
+       ReplicateVars(false);
+       if (ReplicateVars_NOT_SENDING())
+               ReplicateVars_DELAY(0.8 + random() * 0.4); // no need to check cvars every frame
 
        HUD_Scale_Disable();