]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/t_items.qc
Merge branch 'Lyberta/URS2' into Lyberta/RandomStartWeapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / t_items.qc
index ba168fd6f51f64573f3cb10f7c8143f3dab27044..454965ed658e67f515f85226ecdd88a6b344fb71 100644 (file)
@@ -776,22 +776,14 @@ float Item_GiveAmmoTo(entity item, entity player, int resource_type, float ammom
                {
                        return false;
                }
-               if ((player_amount + amount) > ammomax)
-               {
-                       amount = ammomax - player_amount;
-               }
-               GiveResource(player, resource_type, amount);
+               GiveResourceWithLimit(player, resource_type, amount, ammomax);
                return true;
        }
        if (g_weapon_stay != 2)
        {
                return false;
        }
-       float mi = min(amount, ammomax);
-       if (player_amount < mi)
-       {
-               GiveResource(player, resource_type, mi - player_amount);
-       }
+       GiveResourceWithLimit(player, resource_type, amount, min(amount, ammomax));
        return true;
 }