From c8895152636b375ce60f947f6ac5f7dc13799185 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 11 Apr 2007 15:05:56 +0000 Subject: [PATCH] fixed amb186 (state changing crashes) --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40683 --- core/HalfLife2.cpp | 8 +++++++- core/HalfLife2.h | 6 +++--- core/smn_entities.cpp | 7 ------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/core/HalfLife2.cpp b/core/HalfLife2.cpp index 907ef2fa..c2300f21 100644 --- a/core/HalfLife2.cpp +++ b/core/HalfLife2.cpp @@ -38,11 +38,17 @@ CHalfLife2::~CHalfLife2() m_Tables.clear(); } -#if 0 +CSharedEdictChangeInfo *g_pSharedChangeInfo = NULL; + void CHalfLife2::OnSourceModStartup(bool late) { + if (!g_pSharedChangeInfo) + { + g_pSharedChangeInfo = engine->GetSharedEdictChangeInfo(); + } } +#if 0 void CHalfLife2::OnSourceModAllShutdown() { } diff --git a/core/HalfLife2.h b/core/HalfLife2.h index 3f03ff99..dc3ec36b 100644 --- a/core/HalfLife2.h +++ b/core/HalfLife2.h @@ -29,14 +29,14 @@ struct DataTableInfo Trie *lookup; }; -class CHalfLife2 +class CHalfLife2 : public SMGlobalClass { public: CHalfLife2(); ~CHalfLife2(); public: - /*void OnSourceModStartup(bool late); - void OnSourceModAllShutdown();*/ + void OnSourceModStartup(bool late); + /*void OnSourceModAllShutdown();*/ public: SendProp *FindInSendTable(const char *classname, const char *offset); ServerClass *FindServerClass(const char *classname); diff --git a/core/smn_entities.cpp b/core/smn_entities.cpp index dc7ed320..e8652c8e 100644 --- a/core/smn_entities.cpp +++ b/core/smn_entities.cpp @@ -464,8 +464,6 @@ IChangeInfoAccessor *CBaseEdict::GetChangeAccessor() return engine->GetChangeAccessor( (const edict_t *)this ); } -CSharedEdictChangeInfo *g_pSharedChangeInfo = NULL; - static cell_t ChangeEdictState(IPluginContext *pContext, const cell_t *params) { edict_t *pEdict = GetEdict(params[1]); @@ -475,11 +473,6 @@ static cell_t ChangeEdictState(IPluginContext *pContext, const cell_t *params) return pContext->ThrowNativeError("Edict %d is invalid", params[1]); } - if (!g_pSharedChangeInfo) - { - g_pSharedChangeInfo = engine->GetSharedEdictChangeInfo(); - } - if (params[2]) { pEdict->StateChanged(params[2]);