From d23c764e8ce9874d7a831a07f28ad33624e62dfc Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 19 Apr 2022 00:20:01 +0200 Subject: [PATCH] Amend commit 222b94d2d, ReplicateVars_Start was meant to be executed only once --- qcsrc/client/main.qc | 6 +++--- qcsrc/lib/replicate.qh | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index e5b38b768..8bd5d7863 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -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) diff --git a/qcsrc/lib/replicate.qh b/qcsrc/lib/replicate.qh index 470d56aa0..e2e34b197 100644 --- a/qcsrc/lib/replicate.qh +++ b/qcsrc/lib/replicate.qh @@ -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 -- 2.39.2