CancelCreatedEvent actually does what it is supposed to do now...
CancelCreatedEvent actually does what it is supposed to do now...
1.1 --- a/core/EventManager.cpp Thu Apr 12 19:08:01 2007 +0000
1.2 +++ b/core/EventManager.cpp Thu Apr 12 19:49:49 2007 +0000
1.3 @@ -317,6 +317,18 @@
1.4 m_FreeEvents.push(pInfo);
1.5 }
1.6
1.7 +void EventManager::CancelCreatedEvent(EventInfo *pInfo)
1.8 +{
1.9 + /* Free event from IGameEventManager2 */
1.10 + gameevents->FreeEvent(pInfo->pEvent);
1.11 +
1.12 + /* IGameEvent is free at this point, so no one owns this */
1.13 + pInfo->pOwner = NULL;
1.14 +
1.15 + /* Add EventInfo struct to free event stack */
1.16 + m_FreeEvents.push(pInfo);
1.17 +}
1.18 +
1.19 /* IGameEventManager2::FireEvent hook */
1.20 bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
1.21 {
2.1 --- a/core/EventManager.h Thu Apr 12 19:08:01 2007 +0000
2.2 +++ b/core/EventManager.h Thu Apr 12 19:49:49 2007 +0000
2.3 @@ -98,6 +98,7 @@
2.4 EventHookError UnhookEvent(const char *name, IPluginFunction *pFunction, EventHookMode mode=EventHookMode_Post);
2.5 EventInfo *CreateEvent(IPluginContext *pContext, const char *name);
2.6 void FireEvent(EventInfo *pInfo, int flags=0, bool bDontBroadcast=false);
2.7 + void CancelCreatedEvent(EventInfo *pInfo);
2.8 private: // IGameEventManager2 hooks
2.9 bool OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast);
2.10 bool OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast);
3.1 --- a/core/smn_events.cpp Thu Apr 12 19:08:01 2007 +0000
3.2 +++ b/core/smn_events.cpp Thu Apr 12 19:49:49 2007 +0000
3.3 @@ -126,6 +126,8 @@
3.4 return pContext->ThrowNativeError("Game event \"%s\" could not be canceled because it was not created by this plugin", pInfo->pEvent->GetName());
3.5 }
3.6
3.7 + g_EventManager.CancelCreatedEvent(pInfo);
3.8 +
3.9 /* Free handle on game event */
3.10 HandleSecurity sec = {pContext->GetIdentity(), g_pCoreIdent};
3.11 g_HandleSys.FreeHandle(hndl, &sec);