Skip to content

Commit

Permalink
cambio a bool
Browse files Browse the repository at this point in the history
  • Loading branch information
aleeperezz16 committed Jan 4, 2024
1 parent a62e68e commit 403716d
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 14 deletions.
3 changes: 2 additions & 1 deletion reapi/extra/amxmodx/scripting/include/reapi.inc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ enum AType
ATYPE_EVARS,
ATYPE_BOOL,
ATYPE_VECTOR,
ATYPE_TRACE
ATYPE_TRACE,
ATYPE_ITEMINFO
};

enum HookChain
Expand Down
4 changes: 2 additions & 2 deletions reapi/include/cssdk/dlls/regamedll_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,8 @@ typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_PlayerD
typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBasePlayer_PlayerDeathThink;

// PrecacheItemInfo hook
typedef IHookChain<void, ItemInfo *> IReGameHook_PrecacheItemInfo;
typedef IHookChainRegistry<void, ItemInfo *> IReGameHookRegistry_PrecacheItemInfo;
typedef IHookChain<bool, ItemInfo *> IReGameHook_PrecacheItemInfo;
typedef IHookChainRegistry<bool, ItemInfo *> IReGameHookRegistry_PrecacheItemInfo;

class IReGameHookchains {
public:
Expand Down
6 changes: 3 additions & 3 deletions reapi/src/hook_callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1610,14 +1610,14 @@ void BuyItem(IReGameHook_BuyItem *chain, CBasePlayer *pPlayer, int iSlot)
callVoidForward(RG_BuyItem, original, indexOfEdict(pPlayer->pev), iSlot);
}

void PrecacheItemInfo(IReGameHook_PrecacheItemInfo *chain, ItemInfo *info)
bool PrecacheItemInfo(IReGameHook_PrecacheItemInfo *chain, ItemInfo *info)
{
auto original = [chain](ItemInfo* _info)
{
chain->callNext(_info);
return chain->callNext(_info);
};

callVoidForward(RG_PrecacheItemInfo, original, info);
return callForward<bool>(RG_PrecacheItemInfo, original, info);
}

void CSGameRules_Think(IReGameHook_CSGameRules_Think *chain)
Expand Down
2 changes: 1 addition & 1 deletion reapi/src/hook_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ void ClearMultiDamage(IReGameHook_ClearMultiDamage *chain);
void AddMultiDamage(IReGameHook_AddMultiDamage *chain, entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType);
void ApplyMultiDamage(IReGameHook_ApplyMultiDamage *chain, entvars_t *pevInflictor, entvars_t *pevAttacker);
void BuyItem(IReGameHook_BuyItem *chain, CBasePlayer *pPlayer, int iSlot);
void PrecacheItemInfo(IReGameHook_PrecacheItemInfo* chain, ItemInfo* info);
bool PrecacheItemInfo(IReGameHook_PrecacheItemInfo* chain, ItemInfo* info);
void CSGameRules_Think(IReGameHook_CSGameRules_Think *chain);
BOOL CSGameRules_TeamFull(IReGameHook_CSGameRules_TeamFull *chain, int team_id);
BOOL CSGameRules_TeamStacked(IReGameHook_CSGameRules_TeamStacked *chain, int newTeam_id, int curTeam_id);
Expand Down
1 change: 0 additions & 1 deletion reapi/src/member_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ inline MType getMemberType(SecondaryAtkState) { return MEMBER_INTEGER; }
inline MType getMemberType(netadrtype_t) { return MEMBER_INTEGER; }

inline MType getMemberType(TraceResult) { return MEMBER_TRACERESULT; }
inline MType getMemberType(ItemInfo) { return MEMBER_ITEMINFO; }

inline MType getMemberType(short) { return MEMBER_SHORT; }
inline MType getMemberType(unsigned short) { return MEMBER_SHORT; }
Expand Down
2 changes: 0 additions & 2 deletions reapi/src/member_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ enum MType
MEMBER_PMTRACE, // struct pmtrace_t
MEBMER_USERCMD, // struct usercmd_s
MEMBER_TRACERESULT, // struct TraceResult
MEMBER_ITEMINFO, // struct ItemInfo
};

struct memberlist_t
Expand Down Expand Up @@ -123,7 +122,6 @@ struct member_t
case MEMBER_PMTRACE: return "pmtrace";
case MEBMER_USERCMD: return "usercmd";
case MEMBER_TRACERESULT: return "TraceResult";
case MEMBER_ITEMINFO: return "ItemInfo";
default:
{
static char string[16];
Expand Down
3 changes: 0 additions & 3 deletions reapi/src/natives/natives_members.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,6 @@ cell set_member(AMX *amx, void* pdata, const member_t *member, cell* value, size
case MEBMER_REBUYSTRUCT:
case MEMBER_PMTRACE:
case MEBMER_USERCMD:
case MEMBER_ITEMINFO:
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 @@ -1126,8 +1125,6 @@ cell get_member(AMX *amx, void* pdata, const member_t *member, cell* dest, size_
return (cell)get_member_direct<pmtrace_s>(pdata, member->offset, element);
case MEBMER_USERCMD:
return (cell)get_member_direct<usercmd_s>(pdata, member->offset, element);
case MEMBER_ITEMINFO:
return (cell)get_member_direct<ItemInfo>(pdata, member->offset, element);
default: break;
}

Expand Down
3 changes: 2 additions & 1 deletion reapi/src/reapi_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ const char *getATypeStr(AType type)
"ATYPE_EVARS",
"ATYPE_BOOL",
"ATYPE_VECTOR",
"ATYPE_TRACE"
"ATYPE_TRACE",
"ATYPE_ITEMINFO"
};

if (type >= arraysize(s_ATypes))
Expand Down

0 comments on commit 403716d

Please sign in to comment.