This commit is contained in:
Night Owl 2017-07-05 21:44:06 +05:00
parent 19bdc1d01b
commit 9ef79aee9e
3 changed files with 6 additions and 6 deletions

View File

@ -109,8 +109,8 @@ CRpgRocket *CRpgRocket::CreateRpgRocket( Vector vecOrigin, Vector vecAngles, CBa
pRocket->pev->angles = vecAngles;
pRocket->Spawn();
pRocket->SetTouch( &CRpgRocket::RocketTouch );
pRocket->m_pLauncher = pLauncher;// remember what RPG fired me.
pRocket->m_pLauncher->m_cActiveRockets++;// register this missile as active for the launcher
pRocket->m_hLauncher = pLauncher;// remember what RPG fired me.
pLauncher->m_cActiveRockets++;// register this missile as active for the launcher
pRocket->pev->owner = pOwner->edict();
return pRocket;
@ -150,10 +150,10 @@ void CRpgRocket::Spawn( void )
//=========================================================
void CRpgRocket::RocketTouch( CBaseEntity *pOther )
{
if( m_pLauncher )
if( CRpg* pLauncher = (CRpg*)( (CBaseEntity*)( m_hLauncher ) ) )
{
// my launcher is still around, tell it I'm dead.
m_pLauncher->m_cActiveRockets--;
pLauncher->m_cActiveRockets--;
}
STOP_SOUND( edict(), CHAN_VOICE, "weapons/rocket1.wav" );

View File

@ -1518,7 +1518,7 @@ IMPLEMENT_SAVERESTORE( CRpg, CBasePlayerWeapon )
TYPEDESCRIPTION CRpgRocket::m_SaveData[] =
{
DEFINE_FIELD( CRpgRocket, m_flIgniteTime, FIELD_TIME ),
DEFINE_FIELD( CRpgRocket, m_pLauncher, FIELD_CLASSPTR ),
DEFINE_FIELD( CRpgRocket, m_hLauncher, FIELD_EHANDLE ),
};
IMPLEMENT_SAVERESTORE( CRpgRocket, CGrenade )

View File

@ -725,7 +725,7 @@ public:
int m_iTrail;
float m_flIgniteTime;
CRpg *m_pLauncher;// pointer back to the launcher that fired me.
EHANDLE m_hLauncher; // handle back to the launcher that fired me.
};
class CGauss : public CBasePlayerWeapon