Skip to content

Commit bd25ac0

Browse files
authored
Don't pack satchel into weaponbox if all satchels were thrown. Fix #494 (#495)
1 parent 6be11c0 commit bd25ac0

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

dlls/player.cpp

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -785,21 +785,35 @@ void CBasePlayer::PackDeadPlayerItems( void )
785785
}
786786
else
787787
{
788-
// pack the ammo
789-
while( iPackAmmo[iPA] != -1 )
788+
bool bPackItems = true;
789+
if ( iAmmoRules == GR_PLR_DROP_AMMO_ACTIVE && iWeaponRules == GR_PLR_DROP_GUN_ACTIVE )
790790
{
791-
pWeaponBox->PackAmmo( MAKE_STRING( CBasePlayerItem::AmmoInfoArray[iPackAmmo[iPA]].pszName ), m_rgAmmo[iPackAmmo[iPA]] );
792-
iPA++;
791+
if ( rgpPackWeapons[0] == NULL
792+
|| ( FClassnameIs( rgpPackWeapons[0]->pev, "weapon_satchel" ) && ( iPackAmmo[0] == -1 || ( m_rgAmmo[iPackAmmo[0]] == 0 ) ) ) )
793+
{
794+
bPackItems = false;
795+
}
793796
}
794797

795-
// now pack all of the items in the lists
796-
while( rgpPackWeapons[iPW] )
798+
if ( bPackItems )
797799
{
798-
// weapon unhooked from the player. Pack it into der box.
799-
pWeaponBox->PackWeapon( rgpPackWeapons[iPW] );
800+
// pack the ammo
801+
while( iPackAmmo[iPA] != -1 )
802+
{
803+
pWeaponBox->PackAmmo( MAKE_STRING( CBasePlayerItem::AmmoInfoArray[iPackAmmo[iPA]].pszName ), m_rgAmmo[iPackAmmo[iPA]] );
804+
iPA++;
805+
}
800806

801-
iPW++;
807+
// now pack all of the items in the lists
808+
while( rgpPackWeapons[iPW] )
809+
{
810+
// weapon unhooked from the player. Pack it into der box.
811+
pWeaponBox->PackWeapon( rgpPackWeapons[iPW] );
812+
813+
iPW++;
814+
}
802815
}
816+
803817
pWeaponBox->pev->velocity = pev->velocity * 1.2f;// weaponbox has player's velocity, then some.
804818
}
805819
RemoveAllItems( TRUE );// now strip off everything that wasn't handled by the code above.

0 commit comments

Comments
 (0)