mirror of
https://github.com/ChronosX88/mta-mono.git
synced 2024-12-23 01:11:48 +00:00
Check parents in the method CEvent::IsPropagated
This commit is contained in:
parent
27e2ee61f7
commit
2930d23128
@ -32,7 +32,29 @@ CEvent::~CEvent( void )
|
||||
this->m_pEventManager = nullptr;
|
||||
}
|
||||
|
||||
bool CEvent::Call( CElement* pThis, void** params )
|
||||
bool CEvent::IsPropagated( CElement* pSource ) const
|
||||
{
|
||||
if( this->m_bPropagated )
|
||||
{
|
||||
CElement* pParent = pSource;
|
||||
|
||||
while( pParent != this->m_pElement )
|
||||
{
|
||||
pParent = pParent->GetParent();
|
||||
|
||||
if( !pParent )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CEvent::Call( CElement* pThis, PVOID* params ) const
|
||||
{
|
||||
CResource* pResource = this->m_pEventManager->GetResource();
|
||||
|
||||
|
@ -38,13 +38,13 @@ public:
|
||||
CEvent ( CEventManager* pEventManager, string strName, CElement* pElement, MonoObject* pMonoDelegate, bool bPropagated, string strPriority );
|
||||
~CEvent ( void );
|
||||
|
||||
bool Call ( CElement* pThis, void** params );
|
||||
bool Call ( CElement* pThis, PVOID* params ) const;
|
||||
bool IsPropagated ( CElement* pSource ) const;
|
||||
|
||||
string GetName ( void ) { return this->m_strName; }
|
||||
CElement* GetElement ( void ) { return this->m_pElement; }
|
||||
MonoObject* GetDelegate ( void ) { return this->m_pMonoDelegate; }
|
||||
bool IsPropagated ( void ) { return this->m_bPropagated; }
|
||||
string GetPriority ( void ) { return this->m_strPriority; }
|
||||
inline string GetName ( void ) const { return this->m_strName; }
|
||||
inline CElement* GetElement ( void ) const { return this->m_pElement; }
|
||||
inline MonoObject* GetDelegate ( void ) const { return this->m_pMonoDelegate; }
|
||||
inline string GetPriority ( void ) const { return this->m_strPriority; }
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user