From ea3f55f03055a9952a631d39e3a272a5a011eede Mon Sep 17 00:00:00 2001 From: Asher Baker Date: Wed, 26 Aug 2020 12:53:31 +0100 Subject: [PATCH] Remove OnEntitySpawned C++ listener (#1342) This is causing crashes with existing extensions using entity listeners. Currently no one is asking for a C++ hook here, if it is desired it needs to be done with proper versioning of the listener interface, which is going to be a little bit more complicated without an initial hard break. https://forums.alliedmods.net/showpost.php?p=2715337&postcount=789 https://discordapp.com/channels/335290997317697536/335290997317697536/748101258186850334 This is a partial revert of #1078. --- extensions/sdkhooks/extension.cpp | 9 +-------- public/extensions/ISDKHooks.h | 12 +----------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/extensions/sdkhooks/extension.cpp b/extensions/sdkhooks/extension.cpp index 04b115a4..d1c0ac64 100644 --- a/extensions/sdkhooks/extension.cpp +++ b/extensions/sdkhooks/extension.cpp @@ -1831,19 +1831,12 @@ void SDKHooks::HandleEntityCreated(CBaseEntity *pEntity, int index, cell_t ref) void SDKHooks::HandleEntitySpawned(CBaseEntity *pEntity, int index, cell_t ref) { - if (g_pOnEntitySpawned->GetFunctionCount() || m_EntListeners.size()) + if (g_pOnEntitySpawned->GetFunctionCount()) { const char *pName = gamehelpers->GetEntityClassname(pEntity); if (!pName) pName = ""; - // Send OnEntitySpawned to SM listeners - for (SourceHook::List::iterator iter = m_EntListeners.begin(); iter != m_EntListeners.end(); iter++) - { - ISMEntityListener *pListener = (*iter); - pListener->OnEntitySpawned(pEntity, pName); - } - // Call OnEntitySpawned forward if (g_pOnEntitySpawned->GetFunctionCount()) { diff --git a/public/extensions/ISDKHooks.h b/public/extensions/ISDKHooks.h index b4f2dd75..66d6f2c7 100644 --- a/public/extensions/ISDKHooks.h +++ b/public/extensions/ISDKHooks.h @@ -36,7 +36,7 @@ #include #define SMINTERFACE_SDKHOOKS_NAME "ISDKHooks" -#define SMINTERFACE_SDKHOOKS_VERSION 2 +#define SMINTERFACE_SDKHOOKS_VERSION 1 class CBaseEntity; @@ -71,16 +71,6 @@ namespace SourceMod virtual void OnEntityDestroyed(CBaseEntity *pEntity) { } - - /** - * @brief When an entity is spawned - * - * @param pEntity CBaseEntity entity. - * @param classname Entity classname. - */ - virtual void OnEntitySpawned(CBaseEntity *pEntity, const char *classname) - { - } }; /**