[L4D1] Update 'GameEventListener' (#296)

* Update GameEventListener.h

* Update 'CLIENT_DLL_INTERFACE_VERSION'

* Revert "Update 'CLIENT_DLL_INTERFACE_VERSION'"

This reverts commit 961d9bf2bd.
This commit is contained in:
A1m` 2025-01-12 10:17:07 +07:00 committed by GitHub
parent 83d8b2e641
commit 851dfb7f1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,6 +13,8 @@
#include "igameevents.h"
extern IGameEventManager2* gameeventmanager;
// A safer method than inheriting straight from IGameEventListener2.
// Avoids requiring the user to remove themselves as listeners in
// their deconstructor, and sets the serverside variable based on
@ -22,10 +24,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 +51,17 @@ 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: