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
|
||||
|
||||
#include "igameevents.h"
|
||||
extern IGameEventManager2 *gameeventmanager;
|
||||
|
||||
// A safer method than inheriting straight from IGameEventListener2.
|
||||
// Avoids requiring the user to remove themselves as listeners in
|
||||
@ -22,10 +23,12 @@ class CGameEventListener : public IGameEventListener2
|
||||
public:
|
||||
CGameEventListener() : m_bRegisteredForEvents(false)
|
||||
{
|
||||
m_nDebugID = EVENT_DEBUG_ID_INIT;
|
||||
}
|
||||
|
||||
~CGameEventListener()
|
||||
{
|
||||
m_nDebugID = EVENT_DEBUG_ID_SHUTDOWN;
|
||||
StopListeningForAllEvents();
|
||||
}
|
||||
|
||||
@ -47,16 +50,20 @@ public:
|
||||
// remove me from list
|
||||
if ( m_bRegisteredForEvents )
|
||||
{
|
||||
gameeventmanager->RemoveListener( this );
|
||||
if ( gameeventmanager )
|
||||
gameeventmanager->RemoveListener( this );
|
||||
|
||||
m_bRegisteredForEvents = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Intentionally abstract
|
||||
virtual void FireGameEvent( IGameEvent *event ) = 0;
|
||||
|
||||
int m_nDebugID;
|
||||
virtual int GetEventDebugID( void ) { return m_nDebugID; }
|
||||
|
||||
private:
|
||||
|
||||
|
||||
// Have we registered for any events?
|
||||
bool m_bRegisteredForEvents;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user