From: drjaska Date: Thu, 29 Dec 2022 16:43:23 +0000 (+0200) Subject: undo W_UndeprecateName changes X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=85f6176b18d484e01d986eb8fa82d4c071caab19;p=xonotic%2Fxonotic-data.pk3dir.git undo W_UndeprecateName changes --- diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index 369cf7208..819d44f08 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -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; } diff --git a/qcsrc/common/weapons/weapon.qh b/qcsrc/common/weapons/weapon.qh index 717c1f616..a771bc9a0 100644 --- a/qcsrc/common/weapons/weapon.qh +++ b/qcsrc/common/weapons/weapon.qh @@ -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) diff --git a/qcsrc/server/items/items.qc b/qcsrc/server/items/items.qc index 7f3c7e8f6..adb11faa3 100644 --- a/qcsrc/server/items/items.qc +++ b/qcsrc/server/items/items.qc @@ -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; });