Skip to content

Commit 9f98943

Browse files
committed
refactor(asw_weapon): clarify reload condition
1 parent 105e2fc commit 9f98943

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/game/shared/swarm/asw_weapon_shared.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -901,8 +901,7 @@ bool CASW_Weapon::ASWReload( int iClipSize1, int iClipSize2, int iActivity )
901901
if ( UsesClipsForAmmo1() )
902902
{
903903
// need to reload primary clip?
904-
int primary = MIN( iClipSize1 - m_iClip1, pMarine->GetAmmoCount( m_iPrimaryAmmoType ) );
905-
if ( primary > 0 )
904+
if ( m_iClip1 < iClipSize1 && pMarine->GetAmmoCount( m_iPrimaryAmmoType ) > 0 )
906905
{
907906
bReload = true;
908907
}
@@ -929,8 +928,7 @@ bool CASW_Weapon::ASWReload( int iClipSize1, int iClipSize2, int iActivity )
929928
pAmmoBag->GiveClipTo( pMarine, m_iPrimaryAmmoType, true );
930929

931930
// now we've given a clip, check if we can reload
932-
primary = MIN( iClipSize1 - m_iClip1, pMarine->GetAmmoCount( m_iPrimaryAmmoType ) );
933-
if ( primary > 0 )
931+
if ( m_iClip1 < iClipSize1 && pMarine->GetAmmoCount( m_iPrimaryAmmoType ) > 0 )
934932
{
935933
bReload = true;
936934
}
@@ -942,8 +940,7 @@ bool CASW_Weapon::ASWReload( int iClipSize1, int iClipSize2, int iActivity )
942940
if ( UsesClipsForAmmo2() )
943941
{
944942
// need to reload secondary clip?
945-
int secondary = MIN( iClipSize2 - m_iClip2, pMarine->GetAmmoCount( m_iSecondaryAmmoType ) );
946-
if ( secondary > 0 )
943+
if ( m_iClip2 < iClipSize2 && pMarine->GetAmmoCount( m_iSecondaryAmmoType ) > 0 )
947944
{
948945
bReload = true;
949946
}

0 commit comments

Comments
 (0)