Merge pull request #85 from alliedmodders/more-prop-data-types
Fix regression stopping -1 from being a valid value in SetEntPropEnt (r=VoiDeD).
This commit is contained in:
commit
44b2b02a1e
@ -1689,7 +1689,7 @@ static cell_t SetEntPropEnt(IPluginContext *pContext, const cell_t *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CBaseEntity *pOther = GetEntity(params[4]);
|
CBaseEntity *pOther = GetEntity(params[4]);
|
||||||
if (!pOther)
|
if (!pOther && params[4] != -1)
|
||||||
{
|
{
|
||||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[4]), params[4]);
|
return pContext->ThrowNativeError("Entity %d (%d) is invalid", g_HL2.ReferenceToIndex(params[4]), params[4]);
|
||||||
}
|
}
|
||||||
@ -1716,6 +1716,9 @@ static cell_t SetEntPropEnt(IPluginContext *pContext, const cell_t *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case PropEnt_Edict:
|
case PropEnt_Edict:
|
||||||
|
{
|
||||||
|
edict_t *pOtherEdict = NULL;
|
||||||
|
if (pOther)
|
||||||
{
|
{
|
||||||
IServerNetworkable *pNetworkable = ((IServerUnknown *) pOther)->GetNetworkable();
|
IServerNetworkable *pNetworkable = ((IServerUnknown *) pOther)->GetNetworkable();
|
||||||
if (!pNetworkable)
|
if (!pNetworkable)
|
||||||
@ -1723,11 +1726,12 @@ static cell_t SetEntPropEnt(IPluginContext *pContext, const cell_t *params)
|
|||||||
return pContext->ThrowNativeError("Entity %d (%d) does not have a valid edict", g_HL2.ReferenceToIndex(params[4]), params[4]);
|
return pContext->ThrowNativeError("Entity %d (%d) does not have a valid edict", g_HL2.ReferenceToIndex(params[4]), params[4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
edict_t *pOtherEdict = pNetworkable->GetEdict();
|
pOtherEdict = pNetworkable->GetEdict();
|
||||||
if (!pOtherEdict || pOtherEdict->IsFree())
|
if (!pOtherEdict || pOtherEdict->IsFree())
|
||||||
{
|
{
|
||||||
return pContext->ThrowNativeError("Entity %d (%d) does not have a valid edict", g_HL2.ReferenceToIndex(params[4]), params[4]);
|
return pContext->ThrowNativeError("Entity %d (%d) does not have a valid edict", g_HL2.ReferenceToIndex(params[4]), params[4]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*(edict_t **) ((uint8_t *) pEntity + offset) = pOtherEdict;
|
*(edict_t **) ((uint8_t *) pEntity + offset) = pOtherEdict;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user