extensions/sdktools/inputnatives.cpp
changeset 2746 8d68569b9648
parent 2400 76b7b4575e21
     1.1 --- a/extensions/sdktools/inputnatives.cpp	Thu Jul 09 17:51:12 2009 -0400
     1.2 +++ b/extensions/sdktools/inputnatives.cpp	Fri Jul 24 12:34:31 2009 +1200
     1.3 @@ -37,21 +37,11 @@
     1.4  ICallWrapper *g_pAcceptInput = NULL;
     1.5  unsigned char g_Variant_t[SIZEOF_VARIANT_T] = {0};
     1.6  
     1.7 -#define ENTINDEX_TO_CBASEENTITY(index, buffer) \
     1.8 -	pEdict = PEntityOfEntIndex(index); \
     1.9 -	if (!pEdict || pEdict->IsFree()) \
    1.10 -	{ \
    1.11 -		return pContext->ThrowNativeError("Entity %d is not valid or is freed", index); \
    1.12 -	} \
    1.13 -	pUnk = pEdict->GetUnknown(); \
    1.14 -	if (!pUnk) \
    1.15 -	{ \
    1.16 -		return pContext->ThrowNativeError("Entity %d is a not an IServerUnknown", index); \
    1.17 -	} \
    1.18 -	buffer = pUnk->GetBaseEntity(); \
    1.19 +#define ENTINDEX_TO_CBASEENTITY(ref, buffer) \
    1.20 +	buffer = gamehelpers->ReferenceToEntity(ref); \
    1.21  	if (!buffer) \
    1.22  	{ \
    1.23 -		return pContext->ThrowNativeError("Entity %d is not a CBaseEntity", index); \
    1.24 +		return pContext->ThrowNativeError("Entity %d (%d) is not a CBaseEntity", gamehelpers->ReferenceToIndex(ref), ref); \
    1.25  	}
    1.26  
    1.27  /* Hack to init the variant_t object for the first time */
    1.28 @@ -109,8 +99,6 @@
    1.29  	}
    1.30  
    1.31  	CBaseEntity *pActivator, *pCaller, *pDest;
    1.32 -	edict_t *pEdict;
    1.33 -	IServerUnknown *pUnk;
    1.34  
    1.35  	char *inputname;
    1.36  	unsigned char vstk[sizeof(void *) + sizeof(const char *) + sizeof(CBaseEntity *)*2 + SIZEOF_VARIANT_T + sizeof(int)];
    1.37 @@ -257,8 +245,6 @@
    1.38  static cell_t SetVariantEntity(IPluginContext *pContext, const cell_t *params)
    1.39  {
    1.40  	CBaseEntity *pEntity;
    1.41 -	edict_t *pEdict;
    1.42 -	IServerUnknown *pUnk;
    1.43  	unsigned char *vptr = g_Variant_t;
    1.44  	CBaseHandle bHandle;
    1.45