Beispiel #1
0
void CLIENTFX_INSTANCE::DeleteFX(CLinkListNode<FX_LINK> *pDelNode)
{
	if( !pDelNode ) 
		return;

	CBaseFX* pDelFX = pDelNode->m_Data.m_pFX;

	if(pDelFX)
	{
		// Make sure no other active FX in this instance have this pDelFX has their parent...
		CLinkListNode<FX_LINK>	*pActiveNode = m_collActiveFX.GetHead();
		while( pActiveNode )
		{
			CBaseFX *pPossibleChildFX = pActiveNode->m_Data.m_pFX;

			if( pPossibleChildFX && (pPossibleChildFX->GetParent() == pDelFX->GetFXObject()))
			{
				// NULL out the parent otherwise it will reference an object that is no longer there
				pPossibleChildFX->SetParent( LTNULL );
			}
			
			pActiveNode = pActiveNode->m_pNext;
		}

		// Give the FX a chance to clean itself up
		pDelFX->Term();
		CClientFXDB::GetSingleton().DeleteEffect(pDelFX);
	}

	//now remove this node from our list
	m_collActiveFX.Remove(pDelNode);
}