Skip to content

Commit

Permalink
s/get_member: Added support for members with entvars type
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Dec 3, 2023
1 parent 39e4ba8 commit 1d17078
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions reapi/src/natives/natives_members.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,13 @@ cell set_member(AMX *amx, void* pdata, const member_t *member, cell* value, size
set_member<edict_t *>(pdata, member->offset, pEdictValue, element);
return TRUE;
}
case MEMBER_EVARS:
{
// native set_member(_index, any:_member, _value, _elem);
entvars_t *pev = PEV(*value);
set_member<entvars_t *>(pdata, member->offset, pev, element);
return TRUE;
}
case MEMBER_VECTOR:
{
// native set_member(_index, any:_member, Float:_value[3], _elem);
Expand Down Expand Up @@ -978,15 +985,12 @@ cell set_member(AMX *amx, void* pdata, const member_t *member, cell* value, size
set_member<TraceResult>(pdata, member->offset, *(TraceResult *)value, element);
return TRUE;
}

case MEMBER_ENTITY:
case MEMBER_EVARS:
case MEBMER_REBUYSTRUCT:
case MEMBER_PMTRACE:
case MEBMER_USERCMD:
AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: member type %s (%s) is not supported", __FUNCTION__, member_t::getTypeString(member->type), member->name);
return FALSE;

default: break;
}

Expand Down Expand Up @@ -1020,6 +1024,12 @@ cell get_member(AMX *amx, void* pdata, const member_t *member, cell* dest, size_
edict_t *pEntity = get_member<edict_t *>(pdata, member->offset, element);
return pEntity ? indexOfEdict(pEntity) : AMX_NULLENT;
}
case MEMBER_EVARS:
{
// native any:get_member(_index, any:_member, element);
entvars_t *pev = get_member<entvars_t *>(pdata, member->offset, element);
return pev ? indexOfEdict(pev) : AMX_NULLENT;
}
case MEMBER_VECTOR:
{
// native any:get_member(_index, any:_member, any:output[], element);
Expand Down Expand Up @@ -1104,9 +1114,7 @@ cell get_member(AMX *amx, void* pdata, const member_t *member, cell* dest, size_
pSignals[_State] = signal.GetState();
return 1;
}

case MEMBER_ENTITY:
case MEMBER_EVARS:
AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: member type %s (%s) is not supported", __FUNCTION__, member_t::getTypeString(member->type), member->name);
return FALSE;
case MEMBER_TRACERESULT:
Expand Down

0 comments on commit 1d17078

Please sign in to comment.