diff --git a/extension/pluginentityfactory.cpp b/extension/pluginentityfactory.cpp index 6cfe30c..e0f61ed 100644 --- a/extension/pluginentityfactory.cpp +++ b/extension/pluginentityfactory.cpp @@ -894,6 +894,8 @@ IServerNetworkable* CPluginEntityFactory::RecursiveCreate(const char* classname, size_t entitySize = pCreatingFactory->GetEntitySize(); + static MCall ctorCall; + IEntityFactory *pBaseFactory = GetBaseFactory(); if (pBaseFactory) { @@ -929,7 +931,7 @@ IServerNetworkable* CPluginEntityFactory::RecursiveCreate(const char* classname, { bIsInstantiating = true; - CBaseEntityHack* pEnt = (CBaseEntityHack*)engine->PvAllocEntPrivateData(entitySize); + CBaseEntityHack* pEnt = (CBaseEntityHack*)engine->PvAllocEntPrivateData(entitySize + ((4 - (entitySize % 4)) % 4)); CBaseEntityHack::CBaseEntity_Ctor(pEnt, m_Derive.m_bBaseEntityServerOnly); pEnt->PostConstructor(classname); pNet = pEnt->NetworkProp(); @@ -938,8 +940,9 @@ IServerNetworkable* CPluginEntityFactory::RecursiveCreate(const char* classname, { bIsInstantiating = true; - CBaseEntityHack* pEnt = (CBaseEntityHack*)engine->PvAllocEntPrivateData(entitySize); - (pEnt->*(m_Derive.m_pConstructorFunc))(); + CBaseEntityHack* pEnt = (CBaseEntityHack*)engine->PvAllocEntPrivateData(entitySize + ((4 - (entitySize % 4)) % 4)); + ctorCall.Init((void*)m_Derive.m_pConstructorFunc); + ctorCall(pEnt); pEnt->PostConstructor(classname); pNet = pEnt->NetworkProp(); } diff --git a/extension/pluginentityfactory.h b/extension/pluginentityfactory.h index 4e432c7..8c0ba02 100644 --- a/extension/pluginentityfactory.h +++ b/extension/pluginentityfactory.h @@ -172,8 +172,6 @@ class CPluginEntityFactory : public IEntityFactory, public IEntityDataMapContain DERIVETYPE_MAX }; - typedef void* (CBaseEntity::*RawEntityConstructor)(void); - struct PluginEntityFactoryDeriveInfo_t { PluginEntityFactoryDeriveType_t m_DeriveFrom; @@ -182,7 +180,7 @@ class CPluginEntityFactory : public IEntityFactory, public IEntityDataMapContain { PluginEntityFactoryBaseClass_t m_BaseType; Handle_t m_BaseFactoryHandle; - RawEntityConstructor m_pConstructorFunc; + uintptr_t m_pConstructorFunc; }; std::string m_iBaseClassname; diff --git a/product.version b/product.version index a7ee35a..7b378be 100644 --- a/product.version +++ b/product.version @@ -1 +1 @@ -1.8.3 +1.8.4 \ No newline at end of file