Eliminate need for FindEntityByClassname gamedata on sdk2013 and soon css/dods/hl2dm (already on tf2).

This commit is contained in:
Nicholas Hastings 2014-10-30 19:25:26 -04:00
parent 749701014d
commit f0dd129344

View File

@ -714,7 +714,7 @@ static cell_t GetClientEyeAngles(IPluginContext *pContext, const cell_t *params)
return got_angles ? 1 : 0; return got_angles ? 1 : 0;
} }
#if SOURCE_ENGINE >= SE_ORANGEBOX && SOURCE_ENGINE != SE_TF2 #if SOURCE_ENGINE >= SE_ORANGEBOX
static cell_t NativeFindEntityByClassname(IPluginContext *pContext, const cell_t *params) static cell_t NativeFindEntityByClassname(IPluginContext *pContext, const cell_t *params)
{ {
char *searchname; char *searchname;
@ -793,7 +793,15 @@ static cell_t NativeFindEntityByClassname(IPluginContext *pContext, const cell_t
static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *params) static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *params)
{ {
#if SOURCE_ENGINE == SE_TF2 #if SOURCE_ENGINE == SE_TF2 \
|| SOURCE_ENGINE == SE_DODS \
|| SOURCE_ENGINE == SE_HL2DM \
|| SOURCE_ENGINE == SE_CSS \
|| SOURCE_ENGINE == SE_SDK2013
static bool bHasServerTools3 = !!g_SMAPI->GetServerFactory(false)("VSERVERTOOLS003", nullptr);
if (bHasServerTools3)
{
CBaseEntity *pStartEnt = NULL; CBaseEntity *pStartEnt = NULL;
if (params[1] != -1) if (params[1] != -1)
{ {
@ -811,7 +819,9 @@ static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *para
CBaseEntity *pEntity = servertools->FindEntityByClassname(pStartEnt, searchname); CBaseEntity *pEntity = servertools->FindEntityByClassname(pStartEnt, searchname);
return gamehelpers->EntityToBCompatRef(pEntity); return gamehelpers->EntityToBCompatRef(pEntity);
#else }
#endif
static ValveCall *pCall = NULL; static ValveCall *pCall = NULL;
static bool bProbablyNoFEBC = false; static bool bProbablyNoFEBC = false;
@ -869,7 +879,6 @@ static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *para
FINISH_CALL_SIMPLE(&pEntity); FINISH_CALL_SIMPLE(&pEntity);
return gamehelpers->EntityToBCompatRef(pEntity); return gamehelpers->EntityToBCompatRef(pEntity);
#endif // == TF2
} }
#if SOURCE_ENGINE >= SE_ORANGEBOX #if SOURCE_ENGINE >= SE_ORANGEBOX