]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Replace uses of GetCvars with simpler REPLICATE
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 9 Mar 2016 10:38:22 +0000 (21:38 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 9 Mar 2016 10:38:22 +0000 (21:38 +1100)
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/dodging/dodging.qc
qcsrc/common/mutators/mutator/multijump/multijump.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc
qcsrc/lib/replicate.qh
qcsrc/server/miscfunctions.qc

index a9c56737e92cb209aafc8995eb6deb26f35ab8b9..30e19f0f5429ae82bc7c3864f041c575973eaeea 100644 (file)
@@ -1031,11 +1031,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerRegen)
        return false;
 }
 
-MUTATOR_HOOKFUNCTION(buffs, GetCvars)
-{
-       GetCvars_handleFloat(get_cvars_s, get_cvars_f, cvar_cl_buffs_autoreplace, "cl_buffs_autoreplace");
-       return false;
-}
+REPLICATE(cvar_cl_buffs_autoreplace, bool, "cl_buffs_autoreplace");
 
 MUTATOR_HOOKFUNCTION(buffs, BuildMutatorsString)
 {
index 6d3662c7372ec28e694deab0239616a588ebe70f..1707d0a9d0084d95b927cab079aef6e69d4112e8 100644 (file)
@@ -275,11 +275,7 @@ MUTATOR_HOOKFUNCTION(dodging, PlayerPhysics)
 
 #ifdef SVQC
 
-MUTATOR_HOOKFUNCTION(dodging, GetCvars)
-{
-       GetCvars_handleFloat(get_cvars_s, get_cvars_f, cvar_cl_dodging_timeout, "cl_dodging_timeout");
-       return false;
-}
+REPLICATE(cvar_cl_dodging_timeout, float, "cl_dodging_timeout");
 
 MUTATOR_HOOKFUNCTION(dodging, GetPressedKeys)
 {
index 43be345c1e41f23d2a1e74583212cd1ef6dbd362..cd369b87d9b0f62220bfdbb1ddbe4837e41cb2c1 100644 (file)
@@ -116,11 +116,7 @@ MUTATOR_HOOKFUNCTION(multijump, PlayerJump)
 
 #ifdef SVQC
 
-MUTATOR_HOOKFUNCTION(multijump, GetCvars)
-{
-       GetCvars_handleFloat(get_cvars_s, get_cvars_f, cvar_cl_multijump, "cl_multijump");
-       return false;
-}
+REPLICATE(cvar_cl_multijump, bool, "cl_multijump");
 
 MUTATOR_HOOKFUNCTION(multijump, BuildMutatorsString)
 {
index e8014182269d78dc5f857ae8fa612a7dd404d6f3..12687d194345bb1974708dba3a80dd1f9dddd48a 100644 (file)
@@ -1349,13 +1349,8 @@ MUTATOR_HOOKFUNCTION(nades, SpectateCopy)
        return false;
 }
 
-MUTATOR_HOOKFUNCTION(nades, GetCvars)
-{
-       GetCvars_handleFloat(get_cvars_s, get_cvars_f, cvar_cl_nade_type, "cl_nade_type");
-       GetCvars_handleString(get_cvars_s, get_cvars_f, cvar_cl_pokenade_type, "cl_pokenade_type");
-
-       return false;
-}
+REPLICATE(cvar_cl_nade_type, int, "cl_nade_type");
+REPLICATE(cvar_cl_pokenade_type, string, "cl_pokenade_type");
 
 MUTATOR_HOOKFUNCTION(nades, BuildMutatorsString)
 {
index d94cb53974c3e315d612589686bc512eb0aded22..5d3618f9e75f29a0d043d10c34485aa519ead138 100644 (file)
@@ -164,9 +164,6 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerDies)
        return 0;
 }
 
-MUTATOR_HOOKFUNCTION(spawn_near_teammate, GetCvars)
-{
-       GetCvars_handleFloat(get_cvars_s, get_cvars_f, cvar_cl_spawn_near_teammate, "cl_spawn_near_teammate");
-       return false;
-}
+REPLICATE(cvar_cl_spawn_near_teammate, bool, "cl_spawn_near_teammate");
+
 #endif
index eae9a6e6f1389a531d5b5c09a35f241cce8ff11a..f69b6072bea77316d2b5154a20cf760e92cd3c54 100644 (file)
@@ -2,6 +2,13 @@
 
 #ifndef MENUQC
 
+    /**
+     * Replicate a client cvar into a server field
+     *
+     * @param fld   The field to replicate into
+     * @param type  The field type
+     * @param cvar  The cvar name
+     */
        #define REPLICATE(...) EVAL_REPLICATE(OVERLOAD(REPLICATE, __VA_ARGS__))
        #define EVAL_REPLICATE(...) __VA_ARGS__
 
index 2a3ef873413981b40c56f0fd8a4b205a91526f61..df0cd494b326ff924e310ed4f599422f2620f674 100644 (file)
@@ -375,6 +375,36 @@ string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(string wo)
        return o;
 }
 
+REPLICATE(autoswitch, bool, "cl_autoswitch");
+
+REPLICATE(cvar_cl_allow_uid2name, bool, "cl_allow_uid2name");
+
+REPLICATE(cvar_cl_autoscreenshot, int, "cl_autoscreenshot");
+
+REPLICATE(cvar_cl_autotaunt, float, "cl_autotaunt");
+
+REPLICATE(cvar_cl_clippedspectating, bool, "cl_clippedspectating");
+
+REPLICATE(cvar_cl_handicap, float, "cl_handicap");
+
+REPLICATE(cvar_cl_jetpack_jump, bool, "cl_jetpack_jump");
+
+REPLICATE(cvar_cl_movement_track_canjump, bool, "cl_movement_track_canjump");
+
+REPLICATE(cvar_cl_newusekeysupported, bool, "cl_newusekeysupported");
+
+REPLICATE(cvar_cl_noantilag, bool, "cl_noantilag");
+
+REPLICATE(cvar_cl_physics, string, "cl_physics");
+
+REPLICATE(cvar_cl_voice_directional, int, "cl_voice_directional");
+
+REPLICATE(cvar_cl_voice_directional_taunt_attenuation, float, "cl_voice_directional_taunt_attenuation");
+
+REPLICATE(cvar_cl_weaponimpulsemode, int, "cl_weaponimpulsemode");
+
+REPLICATE(cvar_g_xonoticversion, string, "g_xonoticversion");
+
 /**
  * @param f -1: cleanup, 0: request, 1: receive
  */
@@ -393,13 +423,6 @@ void GetCvars(int f)
 
        ReplicateVars(this, s, f);
 
-       GetCvars_handleFloat(s, f, autoswitch, "cl_autoswitch");
-       GetCvars_handleFloat(s, f, cvar_cl_autoscreenshot, "cl_autoscreenshot");
-       GetCvars_handleFloat(s, f, cvar_cl_jetpack_jump, "cl_jetpack_jump");
-       GetCvars_handleString(s, f, cvar_g_xonoticversion, "g_xonoticversion");
-       GetCvars_handleString(s, f, cvar_cl_physics, "cl_physics");
-       GetCvars_handleFloat(s, f, cvar_cl_handicap, "cl_handicap");
-       GetCvars_handleFloat(s, f, cvar_cl_clippedspectating, "cl_clippedspectating");
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList);
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[0], "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete);
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[1], "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete);
@@ -411,16 +434,8 @@ void GetCvars(int f)
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[7], "cl_weaponpriority7", W_FixWeaponOrder_AllowIncomplete);
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[8], "cl_weaponpriority8", W_FixWeaponOrder_AllowIncomplete);
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[9], "cl_weaponpriority9", W_FixWeaponOrder_AllowIncomplete);
-       GetCvars_handleFloat(s, f, cvar_cl_weaponimpulsemode, "cl_weaponimpulsemode");
-       GetCvars_handleFloat(s, f, cvar_cl_autotaunt, "cl_autotaunt");
-       GetCvars_handleFloat(s, f, cvar_cl_noantilag, "cl_noantilag");
-       GetCvars_handleFloat(s, f, cvar_cl_voice_directional, "cl_voice_directional");
-       GetCvars_handleFloat(s, f, cvar_cl_voice_directional_taunt_attenuation, "cl_voice_directional_taunt_attenuation");
 
-       GetCvars_handleFloat(s, f, cvar_cl_allow_uid2name, "cl_allow_uid2name");
        GetCvars_handleFloat(s, f, cvar_cl_allow_uidtracking, "cl_allow_uidtracking");
-       GetCvars_handleFloat(s, f, cvar_cl_movement_track_canjump, "cl_movement_track_canjump");
-       GetCvars_handleFloat(s, f, cvar_cl_newusekeysupported, "cl_newusekeysupported");
 
        // fixup of switchweapon (needed for LMS or when spectating is disabled, as PutClientInServer comes too early)
        if (f > 0)