CancelCreatedEvent actually does what it is supposed to do now...
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40693
This commit is contained in:
parent
9542cf5113
commit
7b74745ceb
@ -317,6 +317,18 @@ void EventManager::FireEvent(EventInfo *pInfo, int flags, bool bDontBroadcast)
|
|||||||
m_FreeEvents.push(pInfo);
|
m_FreeEvents.push(pInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EventManager::CancelCreatedEvent(EventInfo *pInfo)
|
||||||
|
{
|
||||||
|
/* Free event from IGameEventManager2 */
|
||||||
|
gameevents->FreeEvent(pInfo->pEvent);
|
||||||
|
|
||||||
|
/* IGameEvent is free at this point, so no one owns this */
|
||||||
|
pInfo->pOwner = NULL;
|
||||||
|
|
||||||
|
/* Add EventInfo struct to free event stack */
|
||||||
|
m_FreeEvents.push(pInfo);
|
||||||
|
}
|
||||||
|
|
||||||
/* IGameEventManager2::FireEvent hook */
|
/* IGameEventManager2::FireEvent hook */
|
||||||
bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
|
bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
|
||||||
{
|
{
|
||||||
|
@ -98,6 +98,7 @@ public:
|
|||||||
EventHookError UnhookEvent(const char *name, IPluginFunction *pFunction, EventHookMode mode=EventHookMode_Post);
|
EventHookError UnhookEvent(const char *name, IPluginFunction *pFunction, EventHookMode mode=EventHookMode_Post);
|
||||||
EventInfo *CreateEvent(IPluginContext *pContext, const char *name);
|
EventInfo *CreateEvent(IPluginContext *pContext, const char *name);
|
||||||
void FireEvent(EventInfo *pInfo, int flags=0, bool bDontBroadcast=false);
|
void FireEvent(EventInfo *pInfo, int flags=0, bool bDontBroadcast=false);
|
||||||
|
void CancelCreatedEvent(EventInfo *pInfo);
|
||||||
private: // IGameEventManager2 hooks
|
private: // IGameEventManager2 hooks
|
||||||
bool OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast);
|
bool OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast);
|
||||||
bool OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast);
|
bool OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast);
|
||||||
|
@ -126,6 +126,8 @@ static cell_t sm_CancelCreatedEvent(IPluginContext *pContext, const cell_t *para
|
|||||||
return pContext->ThrowNativeError("Game event \"%s\" could not be canceled because it was not created by this plugin", pInfo->pEvent->GetName());
|
return pContext->ThrowNativeError("Game event \"%s\" could not be canceled because it was not created by this plugin", pInfo->pEvent->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_EventManager.CancelCreatedEvent(pInfo);
|
||||||
|
|
||||||
/* Free handle on game event */
|
/* Free handle on game event */
|
||||||
HandleSecurity sec = {pContext->GetIdentity(), g_pCoreIdent};
|
HandleSecurity sec = {pContext->GetIdentity(), g_pCoreIdent};
|
||||||
g_HandleSys.FreeHandle(hndl, &sec);
|
g_HandleSys.FreeHandle(hndl, &sec);
|
||||||
|
Loading…
Reference in New Issue
Block a user