void CClientEntity::CallEventNoParent ( const char* szName, const CLuaArguments& Arguments, CClientEntity* pSource ) { // Call it on us if this isn't the same class it was raised on //TODO not sure why the null check is necessary (eAi) if ( pSource != this && m_pEventManager != NULL && m_pEventManager->HasEvents () ) { m_pEventManager->Call ( szName, Arguments, pSource, this ); } // Call it on all our children if ( ! m_Children.empty () ) { CChildListType ::const_iterator iter = m_Children.begin (); for ( ; iter != m_Children.end (); iter++ ) { CClientEntity* pEntity = *iter; if ( !pEntity->m_pEventManager || pEntity->m_pEventManager->HasEvents () || !pEntity->m_Children.empty () ) { pEntity->CallEventNoParent ( szName, Arguments, pSource ); if ( m_bBeingDeleted ) break; } } } }
void CClientEntity::CallEventNoParent ( const char* szName, const CLuaArguments& Arguments, CClientEntity* pSource ) { // Call it on us if this isn't the same class it was raised on //TODO not sure why the null check is necessary (eAi) if ( pSource != this && m_pEventManager != NULL && m_pEventManager->HasEvents () ) { m_pEventManager->Call ( szName, Arguments, pSource, this ); } // Call it on all our children if ( ! m_Children.empty () ) { CElementListSnapshot* pList = GetChildrenListSnapshot(); pList->AddRef(); // Keep list alive during use for ( CElementListSnapshot::const_iterator iter = pList->begin() ; iter != pList->end() ; iter++ ) { CClientEntity* pEntity = *iter; if ( !pEntity->IsBeingDeleted() ) { if ( !pEntity->m_pEventManager || pEntity->m_pEventManager->HasEvents () || !pEntity->m_Children.empty () ) { pEntity->CallEventNoParent ( szName, Arguments, pSource ); if ( m_bBeingDeleted ) break; } } } pList->Release(); } }