nitpicking

This commit is contained in:
BotoX 2019-09-11 21:09:35 +02:00
parent 246aa90f4d
commit f5933d181e

View File

@ -1820,23 +1820,23 @@ void SDKHooks::HandleEntitySpawned(CBaseEntity *pEntity, int index, cell_t ref)
{ {
if (g_pOnEntitySpawned->GetFunctionCount() || m_EntListeners.size()) if (g_pOnEntitySpawned->GetFunctionCount() || m_EntListeners.size())
{ {
const char *pName = gamehelpers->GetEntityClassname(pEntity);
cell_t bcompatRef = gamehelpers->EntityToBCompatRef(pEntity); cell_t bcompatRef = gamehelpers->EntityToBCompatRef(pEntity);
const char *pName = gamehelpers->GetEntityClassname(pEntity);
if (!pName)
pName = "";
// Send OnEntitySpawned to SM listeners // Send OnEntitySpawned to SM listeners
SourceHook::List<ISMEntityListener *>::iterator iter; for (SourceHook::List<ISMEntityListener *>::iterator iter = m_EntListeners.begin(); iter != m_EntListeners.end(); iter++)
ISMEntityListener *pListener = NULL;
for (iter = m_EntListeners.begin(); iter != m_EntListeners.end(); iter++)
{ {
pListener = (*iter); ISMEntityListener *pListener = (*iter);
pListener->OnEntitySpawned(pEntity, pName ? pName : ""); pListener->OnEntitySpawned(pEntity, pName);
} }
// Call OnEntitySpawned forward // Call OnEntitySpawned forward
if (g_pOnEntitySpawned->GetFunctionCount()) if (g_pOnEntitySpawned->GetFunctionCount())
{ {
g_pOnEntitySpawned->PushCell(bcompatRef); g_pOnEntitySpawned->PushCell(bcompatRef);
g_pOnEntitySpawned->PushString(pName ? pName : ""); g_pOnEntitySpawned->PushString(pName);
g_pOnEntitySpawned->Execute(NULL); g_pOnEntitySpawned->Execute(NULL);
} }
} }