Browse Source

Refactor to simplify

`CheckAmmoPickup` effectively only contained another function call
and itself was only called once. As it also didn't add to readbility,
it needed to be removed.
master
Anton Tarasenko 5 years ago
parent
commit
c2942b6323
  1. 9
      sources/Features/FixAmmoSelling/MutatorListener_FixAmmoSelling.uc

9
sources/Features/FixAmmoSelling/MutatorListener_FixAmmoSelling.uc

@ -33,7 +33,8 @@ static function bool CheckReplacement(Actor other, out byte isSuperRelevant)
return false;
}
CheckAbusableWeapon(KFWeapon(other));
CheckAmmoPickup(KFAmmoPickup(other));
// If it's ammo pickup - we need to stalk it
class'AmmoPickupStalker'.static.StalkAmmoPickup(KFAmmoPickup(other));
return true;
}
@ -46,12 +47,6 @@ private static function CheckAbusableWeapon(KFWeapon newWeapon)
ammoSellingFix.FixWeapon(newWeapon);
}
private static final function CheckAmmoPickup(KFAmmoPickup newAmmoPickup)
{
if (newAmmoPickup == none) return;
class'AmmoPickupStalker'.static.StalkAmmoPickup(newAmmoPickup);
}
// This function recreates the logic of 'KFWeapon.DropFrom()',
// since standard 'ReplaceWith' function produces bad results.
private static function ReplacePickupWith(Pickup oldPickup)