]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Attempt to speed up physics client option selection by checking for empty and default...
authorMario <mario@smbclan.net>
Sat, 13 May 2017 04:55:31 +0000 (14:55 +1000)
committerMario <mario@smbclan.net>
Sat, 13 May 2017 04:55:31 +0000 (14:55 +1000)
qcsrc/common/physics/player.qc

index b108aa92bea049d370852621024595d6b086c694..c4ad8d2eb0d459eb570ea94ca077bb66d0497de1 100644 (file)
 // client side physics
 bool Physics_Valid(string thecvar)
 {
-       return autocvar_g_physics_clientselect && strhasword(autocvar_g_physics_clientselect_options, thecvar);
+       return autocvar_g_physics_clientselect && thecvar != "" && thecvar && && thecvar != "default" strhasword(autocvar_g_physics_clientselect_options, thecvar);
 }
 
 float Physics_ClientOption(entity this, string option, float defaultval)
 {
        if(IS_REAL_CLIENT(this) && Physics_Valid(this.cvar_cl_physics))
        {
-               string s = sprintf("g_physics_%s_%s", this.cvar_cl_physics, option);
+               string s = strcat("g_physics_", this.cvar_cl_physics, "_", option);
                if(cvar_type(s) & CVAR_TYPEFLAG_EXISTS)
                        return cvar(s);
        }
        if(autocvar_g_physics_clientselect && autocvar_g_physics_clientselect_default)
        {
-               string s = sprintf("g_physics_%s_%s", autocvar_g_physics_clientselect_default, option);
+               string s = strcat("g_physics_", autocvar_g_physics_clientselect_default, "_", option);
                if(cvar_type(s) & CVAR_TYPEFLAG_EXISTS)
                        return cvar(s);
        }