diff --git a/dlls/func_tank.cpp b/dlls/func_tank.cpp index ab295e0c..cace610d 100644 --- a/dlls/func_tank.cpp +++ b/dlls/func_tank.cpp @@ -351,6 +351,7 @@ BOOL CFuncTank::StartControl( CBasePlayer *pController ) ALERT( at_console, "using TANK!\n"); m_pController = pController; + m_pController->m_pTank = this; if( m_pController->m_pActiveItem ) { m_pController->m_pActiveItem->Holster(); @@ -380,6 +381,8 @@ void CFuncTank::StopControl() m_pController->m_iHideHUD &= ~HIDEHUD_WEAPONS; pev->nextthink = 0; + + m_pController->m_pTank = NULL; m_pController = NULL; if( IsActive() ) @@ -426,7 +429,6 @@ void CFuncTank::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use } else if( !m_pController && useType != USE_OFF ) { - ( (CBasePlayer*)pActivator )->m_pTank = this; StartControl( (CBasePlayer*)pActivator ); } else diff --git a/dlls/player.cpp b/dlls/player.cpp index 1d198e84..10216734 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -792,10 +792,7 @@ void CBasePlayer::RemoveAllItems( BOOL removeSuit ) m_pLastItem = NULL; if( m_pTank != 0 ) - { m_pTank->Use( this, this, USE_OFF, 0 ); - m_pTank = NULL; - } int i; CBasePlayerItem *pPendingItem; @@ -856,10 +853,7 @@ void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib ) g_pGameRules->PlayerKilled( this, pevAttacker, g_pevLastInflictor ); if( m_pTank != 0 ) - { m_pTank->Use( this, this, USE_OFF, 0 ); - m_pTank = NULL; - } // this client isn't going to be thinking for a while, so reset the sound until they respawn pSound = CSoundEnt::SoundPointerForIndex( CSoundEnt::ClientSoundIndex( edict() ) ); @@ -1402,10 +1396,7 @@ void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle ) m_pActiveItem->Holster(); if( m_pTank != 0 ) - { m_pTank->Use( this, this, USE_OFF, 0 ); - m_pTank = NULL; - } // clear out the suit message cache so we don't keep chattering SetSuitUpdate( NULL, FALSE, 0 ); @@ -1481,7 +1472,6 @@ void CBasePlayer::PlayerUse( void ) // Stop controlling the tank // TODO: Send HUD Update m_pTank->Use( this, this, USE_OFF, 0 ); - m_pTank = NULL; return; } else @@ -2520,7 +2510,6 @@ void CBasePlayer::PostThink() { // they've moved off the platform m_pTank->Use( this, this, USE_OFF, 0 ); - m_pTank = NULL; } }