mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2024-12-23 01:59:43 +08:00
[L4D2] Update GameEventListener.h (#122)
* Update GameEventListener.h * Remove unnecessary
This commit is contained in:
parent
9387871c52
commit
66743d0eee
@ -12,6 +12,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "igameevents.h"
|
#include "igameevents.h"
|
||||||
|
extern IGameEventManager2 *gameeventmanager;
|
||||||
|
|
||||||
// A safer method than inheriting straight from IGameEventListener2.
|
// A safer method than inheriting straight from IGameEventListener2.
|
||||||
// Avoids requiring the user to remove themselves as listeners in
|
// Avoids requiring the user to remove themselves as listeners in
|
||||||
@ -22,10 +23,12 @@ class CGameEventListener : public IGameEventListener2
|
|||||||
public:
|
public:
|
||||||
CGameEventListener() : m_bRegisteredForEvents(false)
|
CGameEventListener() : m_bRegisteredForEvents(false)
|
||||||
{
|
{
|
||||||
|
m_nDebugID = EVENT_DEBUG_ID_INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
~CGameEventListener()
|
~CGameEventListener()
|
||||||
{
|
{
|
||||||
|
m_nDebugID = EVENT_DEBUG_ID_SHUTDOWN;
|
||||||
StopListeningForAllEvents();
|
StopListeningForAllEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,16 +50,20 @@ public:
|
|||||||
// remove me from list
|
// remove me from list
|
||||||
if ( m_bRegisteredForEvents )
|
if ( m_bRegisteredForEvents )
|
||||||
{
|
{
|
||||||
gameeventmanager->RemoveListener( this );
|
if ( gameeventmanager )
|
||||||
|
gameeventmanager->RemoveListener( this );
|
||||||
|
|
||||||
m_bRegisteredForEvents = false;
|
m_bRegisteredForEvents = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Intentionally abstract
|
// Intentionally abstract
|
||||||
virtual void FireGameEvent( IGameEvent *event ) = 0;
|
virtual void FireGameEvent( IGameEvent *event ) = 0;
|
||||||
|
int m_nDebugID;
|
||||||
|
virtual int GetEventDebugID( void ) { return m_nDebugID; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Have we registered for any events?
|
// Have we registered for any events?
|
||||||
bool m_bRegisteredForEvents;
|
bool m_bRegisteredForEvents;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user