aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/shared/basecombatcharacter_shared.cpp
diff options
context:
space:
mode:
authorJohn Schoenick <[email protected]>2015-09-09 18:35:41 -0700
committerJohn Schoenick <[email protected]>2015-09-09 18:35:41 -0700
commit0d8dceea4310fde5706b3ce1c70609d72a38efdf (patch)
treec831ef32c2c801a5c5a80401736b52c7b5a528ec /mp/src/game/shared/basecombatcharacter_shared.cpp
parentUpdated the SDK with the latest code from the TF and HL2 branches. (diff)
downloadsource-sdk-2013-master.tar.xz
source-sdk-2013-master.zip
Updated the SDK with the latest code from the TF and HL2 branches.HEADmaster
Diffstat (limited to 'mp/src/game/shared/basecombatcharacter_shared.cpp')
-rw-r--r--mp/src/game/shared/basecombatcharacter_shared.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/mp/src/game/shared/basecombatcharacter_shared.cpp b/mp/src/game/shared/basecombatcharacter_shared.cpp
index c032cd54..32e823fa 100644
--- a/mp/src/game/shared/basecombatcharacter_shared.cpp
+++ b/mp/src/game/shared/basecombatcharacter_shared.cpp
@@ -90,8 +90,23 @@ bool CBaseCombatCharacter::Weapon_CanSwitchTo( CBaseCombatWeapon *pWeapon )
if ( m_hActiveWeapon )
{
- if ( !m_hActiveWeapon->CanHolster() )
+ if ( !m_hActiveWeapon->CanHolster() && !pWeapon->ForceWeaponSwitch() )
return false;
+
+ if ( IsPlayer() )
+ {
+ CBasePlayer *pPlayer = (CBasePlayer *)this;
+ // check if active weapon force the last weapon to switch
+ if ( m_hActiveWeapon->ForceWeaponSwitch() )
+ {
+ // last weapon wasn't allowed to switch, don't allow to switch to new weapon
+ CBaseCombatWeapon *pLastWeapon = pPlayer->GetLastWeapon();
+ if ( pLastWeapon && pWeapon != pLastWeapon && !pLastWeapon->CanHolster() && !pWeapon->ForceWeaponSwitch() )
+ {
+ return false;
+ }
+ }
+ }
}
return true;