]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Amend commit 222b94d2d, ReplicateVars_Start was meant to be executed only once
authorterencehill <piuntn@gmail.com>
Mon, 18 Apr 2022 22:20:01 +0000 (00:20 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 18 Apr 2022 22:20:01 +0000 (00:20 +0200)
qcsrc/client/main.qc
qcsrc/lib/replicate.qh

index e5b38b76834bb1cb1d40335e058f2c9f71e2a6b8..8bd5d78638c1fc607fd379d7d1b20d82d0b52ca9 100644 (file)
@@ -437,6 +437,9 @@ void PostInit()
 
        TrueAim_Init();
 
+       // this can't be called in CSQC_Init as it'd send cvars too early
+       ReplicateVars_Start();
+
        postinit = true;
 }
 
@@ -665,9 +668,6 @@ NET_HANDLE(ENT_CLIENT_CLIENTDATA, bool isnew)
        spectatee_status = newspectatee_status;
 
        // we could get rid of spectatee_status, and derive it from player_localentnum and player_localnum
-
-       // this can't be called in CSQC_Init as it'd send cvars too early
-       ReplicateVars_Start();
 }
 
 NET_HANDLE(ENT_CLIENT_NAGGER, bool isnew)
index 470d56aa039f72ce71d7d66b2ffc69fbb2dce198..e2e34b19714fa79522f6b6a04f602bd49e14ceb0 100644 (file)
@@ -51,8 +51,11 @@ const int REPLICATEVARS_DESTROY = 1; // destroy data associated with cvars (shut
        }
        void ReplicateVars_Start()
        {
-               ReplicateVars_time = time;
-               ReplicateVars(REPLICATEVARS_SEND_ALL);
+               if (!ReplicateVars_time) // make sure it gets executed only once
+               {
+                       ReplicateVars(REPLICATEVARS_SEND_ALL);
+                       ReplicateVars_time = time;
+               }
        }
        #endif