CPlayer::~CPlayer ( void ) { // Make sure the script debugger doesn't reference us SetScriptDebugLevel ( 0 ); if ( m_pCamera ) { // Remove the camera from its targets FollowingCameras list if ( m_pCamera->GetTarget () ) m_pCamera->GetTarget ()->m_FollowingCameras.remove ( m_pCamera ); delete m_pCamera; m_pCamera = NULL; } // Make sure nobody's syncing us RemoveAllSyncingVehicles (); RemoveAllSyncingPeds (); RemoveAllSyncingObjects (); // Delete the player text manager delete m_pPlayerTextManager; // Destroy our nick if ( m_szNametagText ) { delete [] m_szNametagText; m_szNametagText = NULL; } SetTeam ( NULL, true ); delete m_pPad; delete m_pKeyBinds; // Unlink from manager Unlink (); // Unparent us (CElement's unparenting will crash because of the incomplete vtable at that point) m_bDoNotSendEntities = true; SetParentObject ( NULL ); CElementRefManager::RemoveElementRefs ( ELEMENT_REF_DEBUG ( this, "CPlayer" ), &m_pTeam, NULL ); CElementRefManager::RemoveElementListRef ( ELEMENT_REF_DEBUG ( this, "CPlayer m_lstBroadcastList" ), &m_lstBroadcastList ); CElementRefManager::RemoveElementListRef ( ELEMENT_REF_DEBUG ( this, "CPlayer m_lstIgnoredList" ), &m_lstIgnoredList ); }
CPlayer::~CPlayer ( void ) { // Make sure the script debugger doesn't reference us SetScriptDebugLevel ( 0 ); if ( m_pCamera ) { // Remove the camera from its targets FollowingCameras list if ( m_pCamera->GetTarget () ) m_pCamera->GetTarget ()->m_FollowingCameras.remove ( m_pCamera ); delete m_pCamera; m_pCamera = NULL; } // Make sure nobody's syncing us RemoveAllSyncingVehicles (); RemoveAllSyncingPeds (); RemoveAllSyncingObjects (); // Delete the player text manager delete m_pPlayerTextManager; // Destroy our nick if ( m_szNametagText ) { delete [] m_szNametagText; m_szNametagText = NULL; } SetTeam ( NULL, true ); delete m_pPad; delete m_pKeyBinds; CSimControl::RemoveSimPlayer ( this ); // Unparent us (CElement's unparenting will crash because of the incomplete vtable at that point) m_bDoNotSendEntities = true; SetParentObject ( NULL ); // Do this if ( m_pJackingVehicle ) { if ( m_uiVehicleAction == VEHICLEACTION_JACKING ) { CPed * pOccupant = m_pJackingVehicle->GetOccupant ( 0 ); if ( pOccupant ) { m_pJackingVehicle->SetOccupant ( NULL, 0 ); pOccupant->SetOccupiedVehicle ( NULL, 0 ); pOccupant->SetVehicleAction ( VEHICLEACTION_NONE ); } } if ( m_pJackingVehicle->GetJackingPlayer () == this ) m_pJackingVehicle->SetJackingPlayer ( NULL ); } CElementRefManager::RemoveElementRefs ( ELEMENT_REF_DEBUG ( this, "CPlayer" ), &m_pTeam, NULL ); CElementRefManager::RemoveElementListRef ( ELEMENT_REF_DEBUG ( this, "CPlayer m_lstBroadcastList" ), &m_lstBroadcastList ); CElementRefManager::RemoveElementListRef ( ELEMENT_REF_DEBUG ( this, "CPlayer m_lstIgnoredList" ), &m_lstIgnoredList ); delete m_pPlayerStatsPacket; // Unlink from manager Unlink (); }