]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Optimise ReplicateVars further by only calling cvar() once
authorMario <mario.mario@y7mail.com>
Tue, 24 Dec 2019 16:57:22 +0000 (02:57 +1000)
committerMario <mario.mario@y7mail.com>
Tue, 24 Dec 2019 16:57:22 +0000 (02:57 +1000)
qcsrc/lib/replicate.qh

index a88bde462934134f3585707eff76e81303e8d6c2..31177426066b5b1a78b6ea9cf3b271caad0bd74d 100644 (file)
                        }
 
                #define REPLICATE_SIMPLE(field, cvarname) MACRO_BEGIN \
-                       if (ReplicateVars_NOT_SENDING() && field != cvar(cvarname)) \
+                       if (ReplicateVars_NOT_SENDING()) \
                        { \
-                               localcmd(strcat("cl_cmd sendcvar ", cvarname, "\n")); \
-                               ReplicateVars_DELAY_1FRAME(); \
-                               field = cvar(cvarname); \
-                               return; \
+                               float thecvar = cvar(cvarname); \
+                               if(field != thecvar) \
+                               { \
+                                       localcmd(strcat("cl_cmd sendcvar ", cvarname, "\n")); \
+                                       ReplicateVars_DELAY_1FRAME(); \
+                                       field = thecvar; \
+                                       return; \
+                               } \
                        } \
                MACRO_END
        #endif