]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
multiple fixes for the weapon priority management
authorRudolf Polzer <divverent@alientrap.org>
Wed, 27 Oct 2010 16:34:10 +0000 (18:34 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Wed, 27 Oct 2010 16:34:10 +0000 (18:34 +0200)
qcsrc/client/Defs.qc
qcsrc/client/Main.qc
qcsrc/client/hud.qc
qcsrc/server/miscfunctions.qc

index 0fcd337732e18cb319fcdca03de2a29e48b1f05f..0d822e1642777a5c6e586394b8f4e99cfa61d26e 100644 (file)
@@ -266,3 +266,4 @@ float cr_maxbullets;
 float bgmtime;
 
 string weaponorder_byimpulse;
+string weaponorder_bypriority;
index 897626a4e89024cdc64cdacface730c9b6a7cf47..9c50d7a3442d7fd36585ad836d26ced8ea07f6e6 100644 (file)
@@ -338,8 +338,6 @@ void PostInit(void)
        Porto_Init();
        TrueAim_Init();
 
-       weaponorder_byimpulse = W_FixWeaponOrder_BuildImpulseList(W_FixWeaponOrder_ForceComplete(W_NumberWeaponOrder(cvar_string("cl_weaponpriority"))));
-
        postinit = true;
 }
 
index 3d2ba9f2b5230b6733232ac72d663dbcad5119dd..4272aefbb4c52e4ad29378475cc9eb86429f7a65 100644 (file)
@@ -1448,7 +1448,6 @@ void weaponorder_swap(float i, float j, entity pass)
        weaponorder[j] = h;
 }
 
-string weaponorder_cmp_str_save;
 string weaponorder_cmp_str;
 float weaponorder_cmp(float i, float j, entity pass)
 {
@@ -1597,13 +1596,17 @@ void HUD_Weapons(void)
        }
 
        // TODO make this configurable
-       weaponorder_cmp_str = strcat(" ", weaponorder_byimpulse, " ");
-
-       if(weaponorder_cmp_str != weaponorder_cmp_str_save)
+       if(weaponorder_bypriority != cvar_string("cl_weaponpriority"))
        {
-               if(weaponorder_cmp_str_save)
-                       strunzone(weaponorder_cmp_str_save);
-               weaponorder_cmp_str_save = strzone(weaponorder_cmp_str);
+               if(weaponorder_bypriority)
+                       strunzone(weaponorder_bypriority);
+               if(weaponorder_byimpulse)
+                       strunzone(weaponorder_byimpulse);
+
+               weaponorder_bypriority = strzone(cvar_string("cl_weaponpriority"));
+               weaponorder_byimpulse = strzone(W_FixWeaponOrder_BuildImpulseList(W_FixWeaponOrder_ForceComplete(W_NumberWeaponOrder(weaponorder_bypriority))));
+               weaponorder_cmp_str = strcat(" ", weaponorder_byimpulse, " ");
+
                weapon_cnt = 0;
                for(i = WEP_FIRST; i <= WEP_LAST; ++i)
                {
@@ -1615,6 +1618,8 @@ void HUD_Weapons(void)
                        }
                }
                heapsort(weapon_cnt, weaponorder_swap, weaponorder_cmp, world);
+
+               weaponorder_cmp_str = string_null;
        }
 
        HUD_Panel_DrawBg(1);
index d774958ade3916cf98ee96f55c1613f9bb07e24b..fd3f384582500f469dd44c56f141a389b3ca53cb 100644 (file)
@@ -581,9 +581,7 @@ void GetCvars_handleFloatOnce(string thisname, float f, .float field, string nam
                        stuffcmd(self, strcat("cl_cmd sendcvar ", name, "\n"));
        }
 }
-string W_FixWeaponOrder_ForceComplete(string s);
-string W_FixWeaponOrder_AllowIncomplete(string s);
-string W_FixWeaponOrder_BuildImpulseList(string s);
+float w_getbestweapon(entity e);
 string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(string wo)
 {
        string o, s;