Strip sourcehook containers (#2578)
This commit is contained in:
+8
-11
@@ -41,7 +41,7 @@ EventManager g_EventManager;
|
||||
SH_DECL_HOOK2(IGameEventManager2, FireEvent, SH_NOATTRIB, 0, bool, IGameEvent *, bool);
|
||||
|
||||
const ParamType GAMEEVENT_PARAMS[] = {Param_Cell, Param_String, Param_Cell};
|
||||
typedef List<EventHook *> EventHookList;
|
||||
typedef std::list<EventHook *> EventHookList;
|
||||
|
||||
class EventForwardFilter : public IForwardFilter
|
||||
{
|
||||
@@ -64,13 +64,10 @@ EventManager::EventManager() : m_EventType(0)
|
||||
EventManager::~EventManager()
|
||||
{
|
||||
/* Free memory used by EventInfo structs if any */
|
||||
CStack<EventInfo *>::iterator iter;
|
||||
for (iter = m_FreeEvents.begin(); iter != m_FreeEvents.end(); iter++)
|
||||
{
|
||||
delete (*iter);
|
||||
while (!m_FreeEvents.empty()) {
|
||||
delete m_FreeEvents.top();
|
||||
m_FreeEvents.pop();
|
||||
}
|
||||
|
||||
m_FreeEvents.popall();
|
||||
}
|
||||
|
||||
void EventManager::OnSourceModAllInitialized()
|
||||
@@ -306,7 +303,7 @@ EventHookError EventManager::UnhookEvent(const char *name, IPluginFunction *pFun
|
||||
}
|
||||
|
||||
/* Make sure the event was actually being hooked */
|
||||
if (pHookList->find(pHook) == pHookList->end())
|
||||
if (std::find(pHookList->begin(), pHookList->end(), pHook) == pHookList->end())
|
||||
{
|
||||
return EventHookErr_NotActive;
|
||||
}
|
||||
@@ -335,7 +332,7 @@ EventInfo *EventManager::CreateEvent(IPluginContext *pContext, const char *name,
|
||||
{
|
||||
pInfo = new EventInfo();
|
||||
} else {
|
||||
pInfo = m_FreeEvents.front();
|
||||
pInfo = m_FreeEvents.top();
|
||||
m_FreeEvents.pop();
|
||||
}
|
||||
|
||||
@@ -464,7 +461,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
|
||||
RETURN_META_VALUE(MRES_IGNORED, false);
|
||||
}
|
||||
|
||||
pHook = m_EventStack.front();
|
||||
pHook = m_EventStack.top();
|
||||
|
||||
if (pHook != NULL)
|
||||
{
|
||||
@@ -475,7 +472,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
|
||||
if (pHook->postCopy)
|
||||
{
|
||||
info.bDontBroadcast = bDontBroadcast;
|
||||
info.pEvent = m_EventCopies.front();
|
||||
info.pEvent = m_EventCopies.top();
|
||||
info.pOwner = NULL;
|
||||
hndl = handlesys->CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user