From ed598e9b287ab9a4df41ee664c658dd1528b815c Mon Sep 17 00:00:00 2001 From: BotoX Date: Sat, 4 Mar 2017 01:08:52 +0100 Subject: [PATCH] Fix HookEntityOutput/HookSingleEntityOutput bugs in sdktools. --- extensions/sdktools/output.cpp | 43 ++++++++++------------------------ extensions/sdktools/output.h | 2 -- 2 files changed, 13 insertions(+), 32 deletions(-) diff --git a/extensions/sdktools/output.cpp b/extensions/sdktools/output.cpp index 6df70144..fbf852e8 100644 --- a/extensions/sdktools/output.cpp +++ b/extensions/sdktools/output.cpp @@ -52,7 +52,6 @@ void EntityOutputManager::Shutdown() return; } - EntityOutputs->Destroy(); ClassNames->Destroy(); fireOutputDetour->Destroy(); } @@ -66,7 +65,6 @@ void EntityOutputManager::Init() return; } - EntityOutputs = adtfactory->CreateBasicTrie(); ClassNames = adtfactory->CreateBasicTrie(); } @@ -120,45 +118,30 @@ bool EntityOutputManager::FireEventDetour(void *pOutput, CBaseEntity *pActivator return true; } - char sOutput[20]; - ke::SafeSprintf(sOutput, sizeof(sOutput), "%p", pOutput); - // attempt to directly lookup a hook using the pOutput pointer OutputNameStruct *pOutputName = NULL; - bool fastLookup = false; - - // Fast lookup failed - check the slow way for hooks that haven't fired yet - if ((fastLookup = EntityOutputs->Retrieve(sOutput, (void **)&pOutputName)) == false) + const char *classname = gamehelpers->GetEntityClassname(pCaller); + if (!classname) { - const char *classname = gamehelpers->GetEntityClassname(pCaller); - if (!classname) - { - return true; - } + return true; + } - const char *outputname = FindOutputName(pOutput, pCaller); - if (!outputname) - { - return true; - } + const char *outputname = FindOutputName(pOutput, pCaller); + if (!outputname) + { + return true; + } - pOutputName = FindOutputPointer(classname, outputname, false); + pOutputName = FindOutputPointer(classname, outputname, false); - if (!pOutputName) - { - return true; - } + if (!pOutputName) + { + return true; } if (!pOutputName->hooks.empty()) { - if (!fastLookup) - { - // hook exists on this classname and output - map it into our quick find trie - EntityOutputs->Insert(sOutput, pOutputName); - } - SourceHook::List::iterator _iter; omg_hooks *hook; diff --git a/extensions/sdktools/output.h b/extensions/sdktools/output.h index e71a6b7d..a0394598 100644 --- a/extensions/sdktools/output.h +++ b/extensions/sdktools/output.h @@ -121,8 +121,6 @@ private: const char *FindOutputName(void *pOutput, CBaseEntity *pCaller); - //Maps CEntityOutput * to a OutputNameStruct - IBasicTrie *EntityOutputs; // Maps classname to a ClassNameStruct IBasicTrie *ClassNames;