Fix Ham_Item_GetItemInfo incorrect associated handler (#449)

This commit is contained in:
Vincent Herbet 2017-07-26 20:36:17 +02:00 committed by GitHub
parent 6bd2f1feec
commit 4fcfc913d3
7 changed files with 21 additions and 16 deletions

View File

@ -665,7 +665,7 @@ cell Call_Void_Int_Int_Int(AMX *amx, cell *params)
return 1;
}
cell Call_Void_ItemInfo(AMX *amx, cell *params)
cell Call_Int_ItemInfo(AMX *amx, cell *params)
{
SETUP(1);
@ -677,11 +677,10 @@ cell Call_Void_ItemInfo(AMX *amx, cell *params)
return 0;
}
#if defined(_WIN32)
reinterpret_cast<void (__fastcall *)(void*, int, void *)>(__func)(pv, 0, ptr);
return reinterpret_cast<int (__fastcall *)(void*, int, void *)>(__func)(pv, 0, ptr);
#elif defined(__linux__) || defined(__APPLE__)
reinterpret_cast<void (*)(void *, void *)>(__func)(pv, ptr);
return reinterpret_cast<int (*)(void *, void *)>(__func)(pv, ptr);
#endif
return 1;
}
cell Call_Float_Void(AMX *amx, cell *params)

View File

@ -75,7 +75,7 @@ cell Call_Void_Entvar_Float(AMX *amx, cell *params);
cell Call_Void_Int_Int_Int(AMX *amx, cell *params);
cell Call_Void_ItemInfo(AMX *amx, cell *params);
cell Call_Int_ItemInfo(AMX *amx, cell *params);
cell Call_Float_Void(AMX *amx, cell *params);

View File

@ -1080,9 +1080,12 @@ void Hook_Void_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2, int i3)
KILL_VECTOR()
POP()
}
void Hook_Void_ItemInfo(Hook *hook, void *pthis, void *iteminfo)
int Hook_Int_ItemInfo(Hook *hook, void *pthis, void *iteminfo)
{
PUSH_VOID()
int ret = 0;
int origret = 0;
PUSH_INT()
MAKE_VECTOR()
@ -1092,9 +1095,9 @@ void Hook_Void_ItemInfo(Hook *hook, void *pthis, void *iteminfo)
,iteminfo
PRE_END()
#if defined(_WIN32)
reinterpret_cast<void (__fastcall*)(void*, int, void *)>(hook->func)(pthis, 0, iteminfo);
origret = reinterpret_cast<int (__fastcall*)(void*, int, void *)>(hook->func)(pthis, 0, iteminfo);
#elif defined(__linux__) || defined(__APPLE__)
reinterpret_cast<void (*)(void*, void *)>(hook->func)(pthis, iteminfo);
origret = reinterpret_cast<int (*)(void*, void *)>(hook->func)(pthis, iteminfo);
#endif
POST_START()
@ -1103,6 +1106,9 @@ void Hook_Void_ItemInfo(Hook *hook, void *pthis, void *iteminfo)
KILL_VECTOR()
POP()
CHECK_RETURN()
return ret;
}
float Hook_Float_Void(Hook *hook, void *pthis)

View File

@ -198,10 +198,10 @@ const bool RB_Void_Int_Int_Int = false;
const int PC_Void_Int_Int_Int = 3;
void Hook_Void_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2, int i3);
const bool RT_Void_ItemInfo = true;
const bool RB_Void_ItemInfo = false;
const int PC_Void_ItemInfo = 1;
void Hook_Void_ItemInfo(Hook *hook, void *pthis, void *iteminfo);
const bool RT_Int_ItemInfo = false;
const bool RB_Int_ItemInfo = false;
const int PC_Int_ItemInfo = 1;
int Hook_Int_ItemInfo(Hook *hook, void *pthis, void *iteminfo);
const bool RT_Float_Void = false;

View File

@ -163,7 +163,7 @@ int Create_Void_Int_Int_Int(AMX *amx, const char *func)
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
}
int Create_Void_ItemInfo(AMX *amx, const char *func)
int Create_Int_ItemInfo(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
}

View File

@ -75,7 +75,7 @@ int Create_Void_Entvar_Float(AMX *amx, const char *func);
int Create_Void_Int_Int_Int(AMX *amx, const char *func);
int Create_Void_ItemInfo(AMX *amx, const char *func);
int Create_Int_ItemInfo(AMX *amx, const char *func);
int Create_Float_Void(AMX *amx, const char *func);

View File

@ -514,7 +514,7 @@ hook_t hooklist[] =
{ V("ts_weapon_alternateattack", Void_Void) },
{ V("item_getiteminfo", Void_ItemInfo) }
{ V("item_getiteminfo", Int_ItemInfo) }
};