Consistency: Replace GETEDICT, INDEXENT2 and others things with HLTypeConversion in hamsandwich module

This commit is contained in:
Arkshine
2015-10-07 17:31:28 +02:00
parent bf5fdc2b5c
commit 6f301b5cea
20 changed files with 252 additions and 407 deletions

View File

@@ -641,13 +641,12 @@ static cell AMX_NATIVE_CALL RegisterHamFromEntity(AMX *amx, cell *params)
char *function=MF_GetAmxString(amx, params[3], 0, NULL);
int entid=params[2];
char classname[64];
// Check the entity
edict_t *Entity=INDEXENT_NEW(entid);
edict_t *Entity = TypeConversion.id_to_edict(entid);
if (Entity->pvPrivateData == NULL)
if (!Entity || Entity->pvPrivateData == NULL)
{
MF_LogError(amx, AMX_ERR_NATIVE,"Failed to retrieve classtype for entity id \"%d\", hook for \"%s\" not active.",entid,function);
@@ -656,7 +655,6 @@ static cell AMX_NATIVE_CALL RegisterHamFromEntity(AMX *amx, cell *params)
}
void **vtable=GetVTable(Entity->pvPrivateData, Offsets.GetBase());
if (vtable == NULL)
{
MF_LogError(amx, AMX_ERR_NATIVE,"Failed to retrieve vtable for entity id \"%d\", hook for \"%s\" not active.",entid,function);