]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
undo W_UndeprecateName changes
authordrjaska <drjaska83@gmail.com>
Thu, 29 Dec 2022 16:43:23 +0000 (18:43 +0200)
committerdrjaska <drjaska83@gmail.com>
Thu, 29 Dec 2022 16:43:23 +0000 (18:43 +0200)
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/weapon.qh
qcsrc/server/items/items.qc

index 369cf720814bde9e0fe178333a0145518d580e4b..819d44f08b37ad3503d4042f074d129f8ea41496 100644 (file)
@@ -102,10 +102,27 @@ string W_NameWeaponOrder_MapFunc(string s)
        }
        return s;
 }
+
+string W_UndeprecateName(string s)
+{
+       switch (s)
+       {
+               case "nex": return "vortex";
+               case "rocketlauncher": return "devastator";
+               case "laser": return "blaster";
+               case "minstanex": return "vaporizer";
+               case "grenadelauncher": return "mortar";
+               case "uzi": return "machinegun";
+               case "hmg": return "okhmg";
+               case "rpc": return "okrpc";
+               default: return s;
+       }
+}
+
 string W_NumberWeaponOrder_MapFunc(string s)
 {
        if (s == "0" || stof(s)) return s;
-       s = W_UNDEPRECATENAME(s);
+       s = W_UndeprecateName(s);
        FOREACH(Weapons, it != WEP_Null && it.netname == s, return ftos(i));
        return s;
 }
index 717c1f6161b6b7788c71570f2d0956b96bed7a02..a771bc9a081e8858118a9f24d432c3393af4e56d 100644 (file)
@@ -214,18 +214,8 @@ const int WEP_FLAG_SPECIALATTACK  =  BIT(16); // marked as a special attack (not
 string weaponorder_byid;
 
 // functions:
+string W_UndeprecateName(string s);
 #define W_FIXWEAPONORDER(order, complete) fixPriorityList(order, WEP_FIRST, WEP_LAST, WEP_IMPULSE_BEGIN - WEP_FIRST, complete)
-
-#define W_UNDEPRECATENAME(s) \
-       (s == "nex" ? "vortex" : \
-       s == "rocketlauncher" ? "devastator" : \
-       s == "laser" ? "blaster" : \
-       s == "minstanex" ? "vaporizer" : \
-       s == "grenadelauncher" ? "mortar" : \
-       s == "uzi" ? "machinegun" : \
-       s == "hmg" ? "okhmg" : \
-       s == "rpc" ? "okrpc" : s)
-
 string W_NameWeaponOrder_MapFunc(string s);
 string W_NumberWeaponOrder_MapFunc(string s);
 #define W_NAMEWEAPONORDER(order) mapPriorityList(order, W_NameWeaponOrder_MapFunc)
index 7f3c7e8f6972cb7a1d59bf7d35f78257908a61a7..adb11faa35b3096a95d58e1c5d6ccef94ce02ffd 100644 (file)
@@ -1299,7 +1299,7 @@ spawnfunc(target_items)
                                        }
                                });
                                FOREACH(Weapons, it != WEP_Null, {
-                                       s = W_UNDEPRECATENAME(s);
+                                       s = W_UndeprecateName(s);
                                        if(s == it.netname)
                                        {
                                                STAT(WEAPONS, this) |= (it.m_wepset);
@@ -1366,7 +1366,7 @@ spawnfunc(target_items)
        for(int j = 0; j < n; ++j)
        {
                string s = argv(j);
-               FOREACH(Weapons, it != WEP_Null && W_UNDEPRECATENAME(s) == it.netname, {
+               FOREACH(Weapons, it != WEP_Null && W_UndeprecateName(s) == it.netname, {
                        it.wr_init(it);
                        break;
                });
@@ -1670,7 +1670,7 @@ float GiveItems(entity e, float beginarg, float endarg)
                                        got += GiveBuff(e, it, op, val);
                                        break;
                                });
-                               FOREACH(Weapons, it != WEP_Null && W_UNDEPRECATENAME(cmd) == it.netname, {
+                               FOREACH(Weapons, it != WEP_Null && W_UndeprecateName(cmd) == it.netname, {
                                        got += GiveWeapon(e, it.m_id, op, val);
                                        break;
                                });