core/EventManager.h
changeset 577 39a746736a0f
parent 576 50696154c0b8
child 578 86663b24d7f7
     1.1 --- a/core/EventManager.h	Sun Mar 04 04:05:03 2007 +0000
     1.2 +++ b/core/EventManager.h	Tue Mar 06 04:50:30 2007 +0000
     1.3 @@ -8,7 +8,7 @@
     1.4  * in whole or significant part.
     1.5  * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
     1.6  *
     1.7 -* Version: $$
     1.8 +* Version: $Id$
     1.9  */
    1.10  
    1.11  #ifndef _INCLUDE_SOURCEMOD_CGAMEEVENTMANAGER_H_
    1.12 @@ -18,6 +18,7 @@
    1.13  #include "sourcemm_api.h"
    1.14  #include "sm_trie.h"
    1.15  #include <sh_list.h>
    1.16 +#include <sh_stack.h>
    1.17  #include <IHandleSys.h>
    1.18  #include <IForwardSys.h>
    1.19  #include <IPluginSys.h>
    1.20 @@ -30,7 +31,7 @@
    1.21  struct EventInfo
    1.22  {
    1.23  	IGameEvent *pEvent;
    1.24 -	bool canDelete;
    1.25 +	IdentityToken_t *pOwner;
    1.26  };
    1.27  
    1.28  struct EventHook
    1.29 @@ -87,31 +88,23 @@
    1.30  	 */
    1.31  	inline HandleType_t GetHandleType()
    1.32  	{
    1.33 -		return EventManager::m_EventType;
    1.34 -	}
    1.35 -
    1.36 -	/**
    1.37 -	 * Sets the current SourceMod event notification state.
    1.38 -	 *
    1.39 -	 * If notify is set to true, SourceMod plugins will be notified of events. If false, they will not.
    1.40 -	 * This is temporarily used to make EVENT_PASSTHRU work when firing events from plugins.
    1.41 -	 */
    1.42 -	inline void SetNotifyState(bool notify)
    1.43 -	{
    1.44 -		m_NotifyState = notify;
    1.45 +		return m_EventType;
    1.46  	}
    1.47  public:
    1.48  	EventHookError HookEvent(const char *name, IPluginFunction *pFunction, EventHookMode mode=EventHookMode_Post);
    1.49  	EventHookError UnhookEvent(const char *name, IPluginFunction *pFunction, EventHookMode mode=EventHookMode_Post);
    1.50 +	EventInfo *CreateEvent(IPluginContext *pContext, const char *name);
    1.51 +	void FireEvent(IPluginContext *pContext, EventInfo *pInfo, int flags=0, bool bDontBroadcast=false);
    1.52  private: // IGameEventManager2 hooks
    1.53  	bool OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast);
    1.54  	bool OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast);
    1.55  private:
    1.56  	HandleType_t m_EventType;
    1.57  	Trie *m_EventHooks;
    1.58 -	bool m_NotifyState;
    1.59 +	bool m_NotifyPlugins;
    1.60  	IGameEvent *m_EventCopy;
    1.61  	const char *m_EventName;
    1.62 +	CStack<EventInfo *> m_FreeEvents;
    1.63  };
    1.64  
    1.65  extern EventManager g_EventManager;