]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Get rid of 2 functions
authorterencehill <piuntn@gmail.com>
Fri, 22 Feb 2019 17:58:22 +0000 (18:58 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 22 Feb 2019 17:58:22 +0000 (18:58 +0100)
qcsrc/common/t_items.qc
qcsrc/server/resources.qc
qcsrc/server/resources.qh

index 30d90faaf387285b2fd366820bd8db9e6dbcf446..bce35c7dd78f5a3c56e53bb9f754bb65ec49a9a7 100644 (file)
@@ -746,14 +746,20 @@ bool Item_GiveAmmoTo(entity item, entity player, int res_type, float ammomax)
                {
                        return false;
                }
-               GiveOrTakeResourceWithLimit(player, res_type, amount, ammomax);
+               if (amount < 0)
+                       TakeResourceWithLimit(player, res_type, -amount, ammomax);
+               else
+                       GiveResourceWithLimit(player, res_type, amount, ammomax);
                return true;
        }
        if (g_weapon_stay != 2)
        {
                return false;
        }
-       GiveOrTakeResourceWithLimit(player, res_type, amount, min(amount, ammomax));
+       if (amount < 0)
+               TakeResourceWithLimit(player, res_type, -amount, min(amount, ammomax));
+       else
+               GiveResourceWithLimit(player, res_type, amount, min(amount, ammomax));
        return true;
 }
 
index 6e63b2e3ee687a8750836eca16b643b175bb52ab..e36eb57508680f7d4b9fd8e980aaa3c9d59b9864 100644 (file)
@@ -230,30 +230,6 @@ void TakeResourceWithLimit(entity receiver, int res_type, float amount, float li
        TakeResource(receiver, res_type, amount);
 }
 
-void GiveOrTakeResource(entity receiver, int res_type, float amount)
-{
-       if(amount < 0)
-       {
-               TakeResource(receiver, res_type, amount * -1);
-       }
-       else
-       {
-               GiveResource(receiver, res_type, amount);
-       }
-}
-
-void GiveOrTakeResourceWithLimit(entity receiver, int res_type, float amount, float limit)
-{
-       if(amount < 0)
-       {
-               TakeResourceWithLimit(receiver, res_type, amount * -1, limit);
-       }
-       else
-       {
-               GiveResourceWithLimit(receiver, res_type, amount, limit);
-       }
-}
-
 int GetResourceType(.float res_field)
 {
        switch (res_field)
index 149ef9b88e95bff5ce66229bb92272ef759d5f30..c228b6ec4c04b3512fa3d0190a99861d486d8c44 100644 (file)
@@ -66,21 +66,6 @@ void TakeResource(entity receiver, int res_type, float amount);
 /// \return No return.
 void TakeResourceWithLimit(entity receiver, int res_type, float amount, float limit);
 
-/// \brief Gives to or takes from an entity resource.
-/// \param[in,out] receiver Entity to give or take resource.
-/// \param[in] res_type Type of the resource (a RES_* constant).
-/// \param[in] amount Amount of resource to give or take.
-/// \return No return.
-void GiveOrTakeResource(entity receiver, int res_type, float amount);
-
-/// \brief Gives to or takes from an entity resource but not more/less than a limit.
-/// \param[in,out] receiver Entity to give or take resource.
-/// \param[in] res_type Type of the resource (a RES_* constant).
-/// \param[in] amount Amount of resource to give or take.
-/// \param[in] limit Limit of resources to give or take.
-/// \return No return.
-void GiveOrTakeResourceWithLimit(entity receiver, int res_type, float amount, float limit);
-
 // ===================== Legacy and/or internal API ===========================
 
 /// \brief Converts an entity field to resource type.