Fix some natives relying on a known engine bug related to last player's edict being invalid

This commit is contained in:
Arkshine
2015-10-06 16:45:35 +02:00
parent fd0f6cc429
commit 9980b7ac62
10 changed files with 13 additions and 12 deletions

View File

@ -85,7 +85,7 @@ static cell AMX_NATIVE_CALL set_tr(AMX *amx, cell *params)
}
case TR_pHit:
{
e = INDEXENT(*ptr);
e = INDEXENT2(*ptr);
if (!e || FNullEnt(e))
return 0; //TODO: return error
gfm_tr->pHit = e;

View File

@ -98,7 +98,7 @@ static cell AMX_NATIVE_CALL set_tr2(AMX *amx, cell *params)
}
case TR_pHit:
{
edict_t *e = INDEXENT(*ptr);
edict_t *e = INDEXENT2(*ptr);
if (!e || FNullEnt(e))
return 0; //TODO: return error
tr->pHit = e;

View File

@ -382,7 +382,7 @@ static cell AMX_NATIVE_CALL amx_set_pev(AMX *amx, cell *params)
*(string_t *)EDICT_OFFS(v, offs) = value;
} else if ( (iSwitch > pev_edict_start && iSwitch < pev_edict_end)
|| (iSwitch > pev_edict2_start && iSwitch < pev_absolute_end) ) {
edict_t *e = INDEXENT((int)*blah);
edict_t *e = INDEXENT2((int)*blah);
*(edict_t **)EDICT_OFFS(v, offs) = e;
} else if (iSwitch > pev_vecarray_start && iSwitch < pev_vecarray_end) {
vec3_t vec;
@ -455,7 +455,7 @@ static cell AMX_NATIVE_CALL amx_pev_valid(AMX *amx, cell *params)
{
int idx = static_cast<int>(params[1]);
edict_t *e = INDEXENT(idx);
edict_t *e = INDEXENT2(idx);
if (FNullEnt(e))
return 0;