Fixed regressions in a988c42d4248:
* Fixed crash when prop/data ent is invalid. * Restored GetEntPropEnt/GetEntDataEnt2 functionality when logical ent support is not available.
This commit is contained in:
parent
ab06cf4788
commit
80f7e3092b
@ -620,14 +620,12 @@ static cell_t GetEntDataEnt2(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pEntity + offset);
|
||||
int index = hndl.GetEntryIndex();
|
||||
CBaseEntity *pHandleEntity = g_HL2.ReferenceToEntity(hndl.GetEntryIndex());
|
||||
|
||||
CEntInfo *pInfo = g_HL2.LookupEntity(index);
|
||||
if (pInfo->m_SerialNumber != hndl.GetSerialNumber())
|
||||
if (!pHandleEntity || hndl != reinterpret_cast<IHandleEntity *>(pHandleEntity)->GetRefEHandle())
|
||||
return -1;
|
||||
|
||||
int ref = g_HL2.IndexToReference(index);
|
||||
return g_HL2.ReferenceToBCompatRef(ref);
|
||||
return g_HL2.EntityToBCompatRef(pHandleEntity);
|
||||
}
|
||||
|
||||
/* THIS GUY IS DEPRECATED. */
|
||||
@ -1498,14 +1496,12 @@ static cell_t GetEntPropEnt(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pEntity + offset);
|
||||
int index = hndl.GetEntryIndex();
|
||||
CBaseEntity *pHandleEntity = g_HL2.ReferenceToEntity(hndl.GetEntryIndex());
|
||||
|
||||
CEntInfo *pInfo = g_HL2.LookupEntity(index);
|
||||
if (pInfo->m_SerialNumber != hndl.GetSerialNumber())
|
||||
if (!pHandleEntity || hndl != reinterpret_cast<IHandleEntity *>(pHandleEntity)->GetRefEHandle())
|
||||
return -1;
|
||||
|
||||
int ref = g_HL2.IndexToReference(index);
|
||||
return g_HL2.ReferenceToBCompatRef(ref);
|
||||
return g_HL2.EntityToBCompatRef(pHandleEntity);
|
||||
}
|
||||
|
||||
static cell_t SetEntPropEnt(IPluginContext *pContext, const cell_t *params)
|
||||
|
Loading…
Reference in New Issue
Block a user