From 526d8a5de2c49f32c5c97de9968b13348b5bbd99 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 4 Mar 2004 08:34:11 +0000 Subject: [PATCH] New ENGINE --- dlls/engine/meta_api.cpp | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/dlls/engine/meta_api.cpp b/dlls/engine/meta_api.cpp index b75e78cf..327db529 100755 --- a/dlls/engine/meta_api.cpp +++ b/dlls/engine/meta_api.cpp @@ -1829,35 +1829,25 @@ static cell AMX_NATIVE_CALL create_entity(AMX *amx, cell *params) { return ENTINDEX(pNewEntity); } -// FindEntity, use this in a while loop. will return 0 when theres no entities left. -// It searches by classname. -//(vexd) -static cell AMX_NATIVE_CALL find_entity(AMX *amx, cell *params) { - int iStartEnt = params[1]; +//ej ref'd by jghg +static cell AMX_NATIVE_CALL find_entity(AMX *amx, cell *params) /* 3 param */ +{ + edict_t *pSearch_after_ent = INDEXENT(params[1]); - int iLengthSearchStrn; - char *szValue = AMX_GET_STRING(amx, params[2], iLengthSearchStrn); + char* sCatagory = NULL; - edict_t *pStartEnt; + int len; + char* sValue = GET_AMXSTRING(amx, params[3], 1, len); - if(iStartEnt == -1) { - pStartEnt = NULL; - } else { - pStartEnt = INDEXENT(iStartEnt); + edict_t *pEnt = FIND_ENTITY_BY_STRING(pSearch_after_ent, "classname", sValue); - if(FNullEnt(pStartEnt)) { - return 0; - } - } - int iReturnEnt = ENTINDEX(FIND_ENTITY_BY_STRING(pStartEnt, "classname", szValue)); + if(pEnt) // This even needed? + return ENTINDEX(pEnt); + else + return 0; +} - if(!iReturnEnt || FNullEnt(iReturnEnt)) { - return -1; - } - - return iReturnEnt; -} // DispatchKeyValue, sets a key-value pair for a newly created entity. // Use DispatchSpawn after doing ALL DispatchKeyValues on an entity.