Fix HookEntityOutput/HookSingleEntityOutput bugs in sdktools.
This commit is contained in:
		
							parent
							
								
									9da44d67f1
								
							
						
					
					
						commit
						2d0fff79a8
					
				@ -52,7 +52,6 @@ void EntityOutputManager::Shutdown()
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EntityOutputs->Destroy();
 | 
					 | 
				
			||||||
	ClassNames->Destroy();
 | 
						ClassNames->Destroy();
 | 
				
			||||||
	fireOutputDetour->Destroy();
 | 
						fireOutputDetour->Destroy();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -66,7 +65,6 @@ void EntityOutputManager::Init()
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EntityOutputs = adtfactory->CreateBasicTrie();
 | 
					 | 
				
			||||||
	ClassNames = adtfactory->CreateBasicTrie();
 | 
						ClassNames = adtfactory->CreateBasicTrie();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -120,17 +118,9 @@ bool EntityOutputManager::FireEventDetour(void *pOutput, CBaseEntity *pActivator
 | 
				
			|||||||
		return true;
 | 
							return true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	char sOutput[20];
 | 
					 | 
				
			||||||
	ke::SafeSprintf(sOutput, sizeof(sOutput), "%p", pOutput);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// attempt to directly lookup a hook using the pOutput pointer
 | 
						// attempt to directly lookup a hook using the pOutput pointer
 | 
				
			||||||
	OutputNameStruct *pOutputName = NULL;
 | 
						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);
 | 
						const char *classname = gamehelpers->GetEntityClassname(pCaller);
 | 
				
			||||||
	if (!classname)
 | 
						if (!classname)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@ -149,16 +139,9 @@ bool EntityOutputManager::FireEventDetour(void *pOutput, CBaseEntity *pActivator
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		return true;
 | 
							return true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!pOutputName->hooks.empty())
 | 
						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<omg_hooks *>::iterator _iter;
 | 
							SourceHook::List<omg_hooks *>::iterator _iter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		omg_hooks *hook;
 | 
							omg_hooks *hook;
 | 
				
			||||||
 | 
				
			|||||||
@ -121,8 +121,6 @@ private:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	const char *FindOutputName(void *pOutput, CBaseEntity *pCaller);
 | 
						const char *FindOutputName(void *pOutput, CBaseEntity *pCaller);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//Maps CEntityOutput * to a OutputNameStruct
 | 
					 | 
				
			||||||
	IBasicTrie *EntityOutputs;
 | 
					 | 
				
			||||||
	// Maps classname to a ClassNameStruct
 | 
						// Maps classname to a ClassNameStruct
 | 
				
			||||||
	IBasicTrie *ClassNames;
 | 
						IBasicTrie *ClassNames;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user