1
0
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:
A1m` 2023-03-29 10:08:47 +07:00 committed by GitHub
parent 9387871c52
commit 66743d0eee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,13 +50,17 @@ public:
// remove me from list
if ( m_bRegisteredForEvents )
{
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: