extensions/tf2/natives.cpp
changeset 3818 f25d64a5cd7a
parent 3713 a825343bb3f2
child 4158 ec9737f0382a
     1.1 --- a/extensions/tf2/natives.cpp	Sat Mar 16 14:11:56 2013 -0400
     1.2 +++ b/extensions/tf2/natives.cpp	Sat Mar 16 18:05:22 2013 -0400
     1.3 @@ -236,7 +236,7 @@
     1.4  {
     1.5  	static ICallWrapper *pWrapper = NULL;
     1.6  
     1.7 -	// CTFPlayerShared::AddCond(int, float)
     1.8 +	// CTFPlayerShared::AddCond(int, float, CBaseEntity *)
     1.9  	if (!pWrapper)
    1.10  	{
    1.11  		REGISTER_NATIVE_ADDR("AddCondition", 
    1.12 @@ -259,6 +259,13 @@
    1.13  		return pContext->ThrowNativeError("Client index %d is not valid", params[1]);
    1.14  	}
    1.15  
    1.16 +	CBaseEntity *pInflictor = NULL;
    1.17 +	// Compatibility fix for the new inflictor parameter; TF2 seems to only use player entities in it
    1.18 +	if (params[0] >= 4 && params[4] > 0 && !(pInflictor = UTIL_GetCBaseEntity(params[4], true)))
    1.19 +	{
    1.20 +		return pContext->ThrowNativeError("Inflictor index %d is not valid", params[4]);
    1.21 +	}
    1.22 +
    1.23  	void *obj = (void *)((uint8_t *)pEntity + playerSharedOffset->actual_offset);
    1.24  
    1.25  	unsigned char vstk[sizeof(void *) + sizeof(int) + sizeof(float) + sizeof(CBaseEntity *)];
    1.26 @@ -270,7 +277,7 @@
    1.27  	vptr += sizeof(int);
    1.28  	*(float *)vptr = *(float *)&params[3];
    1.29  	vptr += sizeof(float);
    1.30 -	*(CBaseEntity **)vptr = NULL;
    1.31 +	*(CBaseEntity **)vptr = pInflictor;
    1.32  
    1.33  	pWrapper->Execute(vstk, NULL);
    1.34