fix the ammocount parameter in Weapon.CheckAmmo

This commit is contained in:
Ricardo Luís Vaz Silva 2023-07-08 23:47:11 -03:00 committed by Christoph Oelckers
parent bcfa43b7d6
commit 99850ea216

View file

@ -932,6 +932,7 @@ class Weapon : StateProvider
int count1, count2;
int enough, enoughmask;
int lAmmoUse1;
int lAmmoUse2 = AmmoUse2;
if (sv_infiniteammo || (Owner.FindInventory ('PowerInfiniteAmmo', true) != null))
{
@ -957,20 +958,21 @@ class Weapon : StateProvider
count1 = (Ammo1 != null) ? Ammo1.Amount : 0;
count2 = (Ammo2 != null) ? Ammo2.Amount : 0;
if (bDehAmmo && Ammo1 == null)
{
lAmmoUse1 = 0;
}
else if (ammocount >= 0 && bDehAmmo)
if (ammocount >= 0)
{
lAmmoUse1 = ammocount;
lAmmoUse2 = ammocount;
}
else if (bDehAmmo && Ammo1 == null)
{
lAmmoUse1 = 0;
}
else
{
lAmmoUse1 = AmmoUse1;
}
enough = (count1 >= lAmmoUse1) | ((count2 >= AmmoUse2) << 1);
enough = (count1 >= lAmmoUse1) | ((count2 >= lAmmoUse2) << 1);
if (useboth)
{
enoughmask = 3;