]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Rename AmmoNameFromWeaponentity to GetAmmoName and move it out of miscfunctions
authorMario <mario.mario@y7mail.com>
Fri, 17 Jan 2020 16:07:37 +0000 (02:07 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 17 Jan 2020 16:07:37 +0000 (02:07 +1000)
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/weapon.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh

index f2fdf4407fb6307494ba7201e009c3c21f36091c..ef7a38c4e27bb7979e16e3c7e547aaccbc025fe3 100644 (file)
@@ -225,6 +225,20 @@ string GetAmmoPicture(int ammotype)
        }
 }
 
+string GetAmmoName(int ammotype)
+{
+       switch (ammotype)
+       {
+               case RES_SHELLS:  return ITEM_Shells.m_name;
+               case RES_BULLETS: return ITEM_Bullets.m_name;
+               case RES_ROCKETS: return ITEM_Rockets.m_name;
+               case RES_CELLS:   return ITEM_Cells.m_name;
+               case RES_PLASMA:  return ITEM_Plasma.m_name;
+               case RES_FUEL:    return ITEM_JetpackFuel.m_name;
+               default:          return "batteries";
+       }
+}
+
 #ifdef CSQC
 int GetAmmoTypeFromNum(int i)
 {
index 3dd2a8048af45223f5ddaf383d1a649f262861ec..02fbdb536c283c669714f2ac754df048f3bacd9f 100644 (file)
@@ -216,6 +216,8 @@ WepSet W_RandomWeapons(entity e, WepSet remaining, int n);
 
 string GetAmmoPicture(int ammotype);
 
+string GetAmmoName(int ammotype);
+
 #ifdef CSQC
 int GetAmmoTypeFromNum(int i);
 int GetAmmoStat(int ammotype);
index dd14a049e1bbb661464ab7bfb112c20ccf92c45f..0cc8d79197eb3a91e67864e2a9d609d1957e89fd 100644 (file)
@@ -33,6 +33,7 @@
 #include "../common/state.qh"
 #include "../common/effects/qc/globalsound.qh"
 #include "../common/wepent.qh"
+#include <common/weapons/weapon.qh>
 #include "../lib/csqcmodel/sv_model.qh"
 #include "../lib/warpzone/anglestransform.qh"
 #include "../lib/warpzone/server.qh"
@@ -214,21 +215,6 @@ string NearestLocation(vector p)
     return ret;
 }
 
-string AmmoNameFromWeaponentity(Weapon wep)
-{
-       string ammoitems = "batteries";
-       switch (wep.ammo_type)
-       {
-               case RES_SHELLS:  ammoitems = ITEM_Shells.m_name;      break;
-               case RES_BULLETS: ammoitems = ITEM_Bullets.m_name;     break;
-               case RES_ROCKETS: ammoitems = ITEM_Rockets.m_name;     break;
-               case RES_CELLS:   ammoitems = ITEM_Cells.m_name;       break;
-               case RES_PLASMA:  ammoitems = ITEM_Plasma.m_name;      break;
-               case RES_FUEL:    ammoitems = ITEM_JetpackFuel.m_name; break;
-       }
-       return ammoitems;
-}
-
 string PlayerHealth(entity this)
 {
        float myhealth = floor(GetResource(this, RES_HEALTH));
@@ -311,7 +297,7 @@ string formatmessage(entity this, string msg)
                        case "y": replacement = NearestLocation(cursor); break;
                        case "d": replacement = NearestLocation(this.death_origin); break;
                        case "w": replacement = WeaponNameFromWeaponentity(this, weaponentity); break;
-                       case "W": replacement = AmmoNameFromWeaponentity(this.(weaponentity).m_weapon); break;
+                       case "W": replacement = GetAmmoName(this.(weaponentity).m_weapon.ammo_type); break;
                        case "x": replacement = ((cursor_ent.netname == "" || !cursor_ent) ? "nothing" : cursor_ent.netname); break;
                        case "s": replacement = ftos(vlen(this.velocity - this.velocity_z * '0 0 1')); break;
                        case "S": replacement = ftos(vlen(this.velocity)); break;
index 2b85a0476fe4f6e66d2d6e3d26f95f0a97b93155..71affe5d7c10af49aaad2e5a5ce37f92e0f75c36 100644 (file)
@@ -96,8 +96,6 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
 
 string NearestLocation(vector p);
 
-string AmmoNameFromWeaponentity(Weapon wep);
-
 void play2(entity e, string filename);
 
 string playername(entity p, bool team_colorize);