}
}
public final void performReload( AmmoSet ammoSet, boolean playSound, Point2D.Float reloaderXY, boolean freeAmmo )
{
FireArm fireArm = ( (FireArm)iArtefactType.iArtefactKind );
//put unused ammo back onto the stack!
ammoSet.addAmmo( fireArm.iAmmoType, iMagazineAmmo );
//check ammo stock
int ammo = ammoSet.getAmmo( fireArm.iAmmoType );
int ammoToReload = ( ammo >= fireArm.iMagazineSize ? fireArm.iMagazineSize : ammo );
if ( freeAmmo ) ammoToReload = fireArm.iMagazineSize;
//load ammoToReload into the magazine and substract it from the ammo stock
iMagazineAmmo = ammoToReload;
ammoSet.substractAmmo( fireArm.iAmmoType, ammoToReload );
//play reload sound
if ( playSound )
{
if ( reloaderXY == null )
{
fireArm.getReloadSound().playGlobalFx();
}
else
{
fireArm.getReloadSound().playDistancedFx( reloaderXY );
}
}
}