From b229587cd052cea5100b5300df97bbd93415160e Mon Sep 17 00:00:00 2001 From: Julian Date: Thu, 12 Mar 2020 02:40:45 -0300 Subject: [PATCH] Delete CreateNormalClassPtr, use CreateClassPtr. --- src/dlls/cmbase.h | 40 ---------------------------------------- src/dlls/nodes.cpp | 2 +- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/src/dlls/cmbase.h b/src/dlls/cmbase.h index 4f33789..be21e6a 100644 --- a/src/dlls/cmbase.h +++ b/src/dlls/cmbase.h @@ -608,43 +608,3 @@ template T * CreateClassPtr( T *a ) return a; } - -// -// Converts a entvars_t * to a class pointer -// It will allocate the class and entity -// Use this for non-monsters entities -// -// WARNING: This does not check for free edicts! -// -template T * CreateNormalClassPtr( T *a ) -{ - entvars_t *pev = (entvars_t *)a; - - if (pev != NULL) - return NULL; // don't allocate if pointer already provided - - // allocate entity... - edict_t *temp_edict; - int edict_index; - - // allocate private data - a = new T; - - if ((temp_edict = a->CreateEntity("info_target")) == NULL) - { - (*g_engfuncs.pfnServerPrint)("[MONSTER] ERROR: NULL Ent in CreateNormalClassPtr!\n" ); - delete a; - return NULL; - } - - edict_index = (*g_engfuncs.pfnIndexOfEdict)(temp_edict); - - // store the class pointer to the edict pev... - pev = VARS(temp_edict); - a->pev = pev; - - // get the private data - a = (T *)pev->euser4; - - return a; -} diff --git a/src/dlls/nodes.cpp b/src/dlls/nodes.cpp index cb12def..dd96262 100644 --- a/src/dlls/nodes.cpp +++ b/src/dlls/nodes.cpp @@ -1533,7 +1533,7 @@ void CNodeEnt :: Spawn( void ) if ( WorldGraph.m_cNodes == 0 ) { // this is the first node to spawn, spawn the test hull entity that builds and walks the node tree - CTestHull *pHull = CreateNormalClassPtr((CTestHull *)NULL); + CTestHull *pHull = CreateClassPtr((CTestHull *)NULL); pHull->Spawn( pev ); }