Fakemeta: fixed bug with recursive pre hooks (one returned supercede can supercede several hooks)

This commit is contained in:
WPMGPRoSToTeMa 2016-01-26 01:19:51 +03:00
parent 0462ca02c8
commit 3c74e72242
3 changed files with 7 additions and 10 deletions

View File

@ -24,7 +24,6 @@ float mlFloatResult;
const char *mStringResult;
const char *mlStringResult;
int retType = 0;
int lastFmRes = FMRES_IGNORED;
KVD_Wrapper g_kvd_hook;
clientdata_t *g_cd_hook;
entity_state_t *g_es_hook;
@ -55,7 +54,6 @@ void clfm()
mlCellResult = 0;
mStringResult = "";
mlStringResult = "";
lastFmRes = FMRES_IGNORED;
mFloatResult = 0.0;
mlFloatResult = 0.0;
}

View File

@ -193,7 +193,6 @@ extern const char *mStringResult;
extern cell mlCellResult;
extern float mlFloatResult;
extern const char *mlStringResult;
extern int lastFmRes;
extern int retType;
#endif //_INCLUDE_FORWARD_H

View File

@ -751,14 +751,12 @@
#define SIMPLE_VOID_HOOK_INT_INT_CONSTVECT_EDICT(call) \
void call (int v, int vb, const float *vec, edict_t *e) \
{ \
if (vec) { \
const float b[3]={0.0,0.0,0.0}; \
if (vec == nullptr) { \
vec = b; \
} \
PREPARE_VECTOR(vec); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)v, (cell)vb, p_vec, (cell)ENTINDEX(e))); \
} else { \
const float b[3]={0.0,0.0,0.0}; \
PREPARE_VECTOR(b); \
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), (cell)v, (cell)vb, p_b, (cell)ENTINDEX(e))); \
} \
RETURN_META(mswi(lastFmRes)); \
} \
void call##_post (int v, int vb, const float *vec, edict_t *e) \
@ -924,6 +922,7 @@
register unsigned int i = 0; \
clfm(); \
int fmres = FMRES_IGNORED; \
int lastFmRes = FMRES_IGNORED; \
for (i=0; i<Engine[pfnCall].length(); i++) \
{ \
fmres = MF_ExecuteForward pfnArgs; \
@ -941,6 +940,7 @@
register unsigned int i = 0; \
clfm(); \
int fmres = FMRES_IGNORED; \
int lastFmRes = FMRES_IGNORED; \
for (i=0; i<EnginePost[pfnCall].length(); i++) \
{ \
fmres = MF_ExecuteForward pfnArgs; \