mirror of
https://github.com/rehlds/reapi.git
synced 2024-12-28 15:45:31 +03:00
Removed static keyword for natives
Reduced error strings length
This commit is contained in:
parent
7a3992e960
commit
063f8e6ed5
@ -51,7 +51,7 @@ struct regfunc
|
||||
};
|
||||
}
|
||||
|
||||
regfunc(const char *error) { UTIL_SysError(error); } // to cause a amxx module failure.
|
||||
regfunc(const char *name) { UTIL_SysError("%s doesn't match hook definition", name); } // to cause a amxx module failure.
|
||||
operator regfunc_t() const { return func; }
|
||||
regfunc_t func;
|
||||
|
||||
@ -60,7 +60,7 @@ struct regfunc
|
||||
|
||||
int regfunc::current_cell = 1;
|
||||
|
||||
#define ENG(h) { {}, {}, #h, "ReHLDS", [](){ return api_cfg.hasReHLDS(); }, ((!(RH_##h & (MAX_REGION_RANGE - 1)) ? regfunc::current_cell = 1, true : false) || (RH_##h & (MAX_REGION_RANGE - 1)) == regfunc::current_cell++) ? regfunc(h) : regfunc(#h " doesn't match hook definition"), [](){ g_RehldsHookchains->##h##()->registerHook(&##h); }, [](){ g_RehldsHookchains->##h##()->unregisterHook(&##h); }}
|
||||
#define ENG(h) { {}, {}, #h, "ReHLDS", [](){ return api_cfg.hasReHLDS(); }, ((!(RH_##h & (MAX_REGION_RANGE - 1)) ? regfunc::current_cell = 1, true : false) || (RH_##h & (MAX_REGION_RANGE - 1)) == regfunc::current_cell++) ? regfunc(h) : regfunc(#h), [](){ g_RehldsHookchains->##h##()->registerHook(&##h); }, [](){ g_RehldsHookchains->##h##()->unregisterHook(&##h); }}
|
||||
hook_t hooklist_engine[] = {
|
||||
ENG(SV_StartSound),
|
||||
ENG(SV_DropClient),
|
||||
@ -68,7 +68,7 @@ hook_t hooklist_engine[] = {
|
||||
ENG(Cvar_DirectSet)
|
||||
};
|
||||
|
||||
#define DLL(h) { {}, {}, #h, "ReGameDLL", [](){ return api_cfg.hasReGameDLL(); }, ((!(RG_##h & (MAX_REGION_RANGE - 1)) ? regfunc::current_cell = 1, true : false) || (RG_##h & (MAX_REGION_RANGE - 1)) == regfunc::current_cell++) ? regfunc(h) : regfunc(#h " doesn't match hook definition"), [](){ g_ReGameHookchains->##h##()->registerHook(&##h); }, [](){ g_ReGameHookchains->##h##()->unregisterHook(&##h); }}
|
||||
#define DLL(h) { {}, {}, #h, "ReGameDLL", [](){ return api_cfg.hasReGameDLL(); }, ((!(RG_##h & (MAX_REGION_RANGE - 1)) ? regfunc::current_cell = 1, true : false) || (RG_##h & (MAX_REGION_RANGE - 1)) == regfunc::current_cell++) ? regfunc(h) : regfunc(#h), [](){ g_ReGameHookchains->##h##()->registerHook(&##h); }, [](){ g_ReGameHookchains->##h##()->unregisterHook(&##h); }}
|
||||
hook_t hooklist_gamedll[] = {
|
||||
DLL(GetForceCamera),
|
||||
DLL(PlayerBlind),
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
#define CLASS_MEMBERS(cx, mx) ((!(mx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (mx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember([](member_t* ptr){ decltype(##cx::##mx) f = {};ptr->size = getTypeSize(f);ptr->max_size = sizeof(f);ptr->offset = offsetof(##cx, ##mx);ptr->type = getMemberType(f);}) : regmember(#mx " doesn't match member definition")
|
||||
#define CLASS_MEMBERS(cx, mx) ((!(mx & (MAX_REGION_RANGE - 1)) ? regmember::current_cell = 1, true : false) || (mx & (MAX_REGION_RANGE - 1)) == regmember::current_cell++) ? regmember([](member_t* ptr){ decltype(##cx::##mx) f = {};ptr->size = getTypeSize(f);ptr->max_size = sizeof(f);ptr->offset = offsetof(##cx, ##mx);ptr->type = getMemberType(f);}) : regmember(#mx)
|
||||
|
||||
#define GM_MEMBERS(mx) CLASS_MEMBERS(CHalfLifeMultiplay, mx)
|
||||
#define GM_VOICE_MEMBERS(mx) CLASS_MEMBERS(CVoiceGameMgr, mx)
|
||||
@ -59,7 +59,7 @@ struct regmember
|
||||
template<typename T>
|
||||
regmember(T lambdaFunc) { lambdaFunc(&member); }
|
||||
|
||||
regmember(const char *error) { UTIL_SysError(error); } // to cause a amxx module failure.
|
||||
regmember(const char *name) { UTIL_SysError("%s doesn't match member definition", name); } // to cause a amxx module failure.
|
||||
operator member_t() const { return member; }
|
||||
member_t member;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
* native RegisterHookChain(any:function_id, const callback[], post = 0);
|
||||
*/
|
||||
|
||||
static cell AMX_NATIVE_CALL RegisterHookChain(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL RegisterHookChain(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_func, arg_handler, arg_post };
|
||||
|
||||
@ -60,7 +60,7 @@ static cell AMX_NATIVE_CALL RegisterHookChain(AMX *amx, cell *params)
|
||||
* native bool:EnableHookChain(any:fwd);
|
||||
*/
|
||||
|
||||
static cell AMX_NATIVE_CALL EnableHookChain(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL EnableHookChain(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_handle_hook };
|
||||
|
||||
@ -85,7 +85,7 @@ static cell AMX_NATIVE_CALL EnableHookChain(AMX *amx, cell *params)
|
||||
* native bool:DisableHookChain(any:fwd);
|
||||
*/
|
||||
|
||||
static cell AMX_NATIVE_CALL DisableHookChain(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL DisableHookChain(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_handle_hook };
|
||||
|
||||
@ -111,7 +111,7 @@ static cell AMX_NATIVE_CALL DisableHookChain(AMX *amx, cell *params)
|
||||
* native SetHookChainReturn(AType:type, any:...);
|
||||
*/
|
||||
|
||||
static cell AMX_NATIVE_CALL SetHookChainReturn(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL SetHookChainReturn(AMX *amx, cell *params)
|
||||
{
|
||||
if (!g_hookCtx)
|
||||
{
|
||||
@ -169,7 +169,7 @@ static cell AMX_NATIVE_CALL SetHookChainReturn(AMX *amx, cell *params)
|
||||
* native GetHookChainReturn(AType:type, any:...);
|
||||
*/
|
||||
|
||||
static cell AMX_NATIVE_CALL GetHookChainReturn(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL GetHookChainReturn(AMX *amx, cell *params)
|
||||
{
|
||||
if (!g_hookCtx)
|
||||
{
|
||||
@ -218,7 +218,7 @@ static cell AMX_NATIVE_CALL GetHookChainReturn(AMX *amx, cell *params)
|
||||
* native SetHookChainArg(number, AType:type, any:...);
|
||||
*/
|
||||
|
||||
static cell AMX_NATIVE_CALL SetHookChainArg(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL SetHookChainArg(AMX *amx, cell *params)
|
||||
{
|
||||
if (!g_hookCtx)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
// native set_member(_index, any:_member, any:...);
|
||||
static cell AMX_NATIVE_CALL set_member(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL set_member(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_member, arg_value, arg_elem };
|
||||
member_t *member = memberlist[params[arg_member]];
|
||||
@ -24,7 +24,7 @@ static cell AMX_NATIVE_CALL set_member(AMX *amx, cell *params)
|
||||
}
|
||||
|
||||
// native any:get_member(_index, any:_member, any:...);
|
||||
static cell AMX_NATIVE_CALL get_member(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL get_member(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_member, arg_3, arg_4 };
|
||||
member_t *member = memberlist[params[arg_member]];
|
||||
@ -68,7 +68,7 @@ static cell AMX_NATIVE_CALL get_member(AMX *amx, cell *params)
|
||||
}
|
||||
|
||||
// native set_member_game(any:_member, any:...);
|
||||
static cell AMX_NATIVE_CALL set_member_game(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL set_member_game(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_member, arg_value, arg_elem };
|
||||
member_t *member = memberlist[params[arg_member]];
|
||||
@ -90,7 +90,7 @@ static cell AMX_NATIVE_CALL set_member_game(AMX *amx, cell *params)
|
||||
}
|
||||
|
||||
// native get_member_game(any:_member, any:...);
|
||||
static cell AMX_NATIVE_CALL get_member_game(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL get_member_game(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_member, arg_3, arg_4 };
|
||||
member_t *member = memberlist[params[arg_member]];
|
||||
|
@ -10,7 +10,7 @@
|
||||
*
|
||||
* native rg_set_animation(index, PLAYER_ANIM:playerAnim);
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL rg_set_animation(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL rg_set_animation(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_anim };
|
||||
|
||||
@ -37,7 +37,7 @@ static cell AMX_NATIVE_CALL rg_set_animation(AMX *amx, cell *params)
|
||||
*
|
||||
* native rg_add_account(index, amount, bool:bTrackChange = true);
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL rg_add_account(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL rg_add_account(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_amount, arg_track_change };
|
||||
|
||||
@ -63,7 +63,7 @@ static cell AMX_NATIVE_CALL rg_add_account(AMX *amx, cell *params)
|
||||
*
|
||||
* native rg_give_item(index, const pszName[]);
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL rg_give_item(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL rg_give_item(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_item };
|
||||
|
||||
@ -89,7 +89,7 @@ static cell AMX_NATIVE_CALL rg_give_item(AMX *amx, cell *params)
|
||||
*
|
||||
* native rg_give_default_items(index);
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL rg_give_default_items(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL rg_give_default_items(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index };
|
||||
|
||||
@ -115,7 +115,7 @@ static cell AMX_NATIVE_CALL rg_give_default_items(AMX *amx, cell *params)
|
||||
*
|
||||
* native rg_give_shield(index, bool:bDeploy = true);
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL rg_give_shield(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL rg_give_shield(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index, arg_deploy };
|
||||
|
||||
@ -146,7 +146,7 @@ static cell AMX_NATIVE_CALL rg_give_shield(AMX *amx, cell *params)
|
||||
*
|
||||
* native rg_dmg_radius(Float:vecSrc[3], inflictor, attacker, Float:flDamage, Float:flRadius, iClassIgnore, bitsDamageType);
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL rg_dmg_radius(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL rg_dmg_radius(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_vec, arg_inflictor, arg_attacker, arg_damage, arg_radius, arg_ignore_class, arg_dmg_type };
|
||||
|
||||
@ -166,7 +166,7 @@ static cell AMX_NATIVE_CALL rg_dmg_radius(AMX *amx, cell *params)
|
||||
*
|
||||
* native rg_multidmg_clear();
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL rg_multidmg_clear(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL rg_multidmg_clear(AMX *amx, cell *params)
|
||||
{
|
||||
g_ReGameFuncs->ClearMultiDamage();
|
||||
return TRUE;
|
||||
@ -182,7 +182,7 @@ static cell AMX_NATIVE_CALL rg_multidmg_clear(AMX *amx, cell *params)
|
||||
*
|
||||
* native rg_multidmg_apply(inflictor, attacker);
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL rg_multidmg_apply(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL rg_multidmg_apply(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_inflictor, arg_attacker };
|
||||
|
||||
@ -207,7 +207,7 @@ static cell AMX_NATIVE_CALL rg_multidmg_apply(AMX *amx, cell *params)
|
||||
*
|
||||
* native rg_multidmg_add(inflictor, victim, Float:flDamage, bitsDamageType);
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL rg_multidmg_add(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL rg_multidmg_add(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_inflictor, arg_victim, arg_damage, arg_dmg_type };
|
||||
|
||||
@ -243,7 +243,7 @@ static cell AMX_NATIVE_CALL rg_multidmg_add(AMX *amx, cell *params)
|
||||
*
|
||||
* native rg_fire_bullets(inflictor, attacker, shots, Float:vecSrc[3], Float:vecDirShooting[3], Float::vecSpread[3], Float:flDistance, iBulletType, iTracerFreq, iDamage);
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL rg_fire_bullets(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL rg_fire_bullets(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_inflictor, arg_attacker, arg_shots, arg_vecSrc, arg_dir, arg_spread, arg_dist, arg_bullet_type, arg_tracefrq, arg_dmg };
|
||||
|
||||
@ -289,7 +289,7 @@ static cell AMX_NATIVE_CALL rg_fire_bullets(AMX *amx, cell *params)
|
||||
*
|
||||
* native Float:[3] rg_fire_bullets3(inflictor, attacker, Float:vecSrc[3], Float:vecDirShooting[3], Float:vecSpread, Float:flDistance, iPenetration, iBulletType, iDamage, Float:flRangeModifier, bool:bPistol, shared_rand);
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL rg_fire_bullets3(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL rg_fire_bullets3(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_inflictor, arg_attacker, arg_vecSrc, arg_dir, arg_spread, arg_dist, arg_penetration, arg_bullet_type, arg_dmg, arg_range_mod, arg_pistol, arg_rand, arg_out };
|
||||
|
||||
@ -354,7 +354,7 @@ struct {
|
||||
*
|
||||
* native rg_round_end(Float:tmDelay, WinStatus:st, ScenarioEventEndRound:event = ROUND_NONE, const message[] = "default", const sentence[] = "default");
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL rg_round_end(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL rg_round_end(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_delay, arg_win, arg_event, arg_message, arg_sentence, arg_silent };
|
||||
|
||||
@ -399,7 +399,7 @@ static cell AMX_NATIVE_CALL rg_round_end(AMX *amx, cell *params)
|
||||
*
|
||||
* native rg_update_teamscores(iCtsWins = 0, iTsWins = 0, bool:bAdd = true);
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL rg_update_teamscores(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL rg_update_teamscores(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_cts, arg_ts, arg_add };
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
* native VTC_IsClientSpeaking(index);
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL VTC_IsClientSpeaking(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL VTC_IsClientSpeaking(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index };
|
||||
return g_pVoiceTranscoderApi->IsClientSpeaking((size_t)params[arg_index]);
|
||||
@ -22,7 +22,7 @@ static cell AMX_NATIVE_CALL VTC_IsClientSpeaking(AMX *amx, cell *params)
|
||||
*
|
||||
* native VTC_MuteClient(index);
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL VTC_MuteClient(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL VTC_MuteClient(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index };
|
||||
g_pVoiceTranscoderApi->MuteClient((size_t)params[arg_index]);
|
||||
@ -38,7 +38,7 @@ static cell AMX_NATIVE_CALL VTC_MuteClient(AMX *amx, cell *params)
|
||||
*
|
||||
* native VTC_UnmuteClient(index);
|
||||
*/
|
||||
static cell AMX_NATIVE_CALL VTC_UnmuteClient(AMX *amx, cell *params)
|
||||
cell AMX_NATIVE_CALL VTC_UnmuteClient(AMX *amx, cell *params)
|
||||
{
|
||||
enum args_e { arg_count, arg_index };
|
||||
g_pVoiceTranscoderApi->UnmuteClient((size_t)params[arg_index]);
|
||||
|
Loading…
Reference in New Issue
Block a user