From 3c74e7224220b58a82e39db41039b195336ff3ad Mon Sep 17 00:00:00 2001 From: WPMGPRoSToTeMa Date: Tue, 26 Jan 2016 01:19:51 +0300 Subject: [PATCH] Fakemeta: fixed bug with recursive pre hooks (one returned supercede can supercede several hooks) --- modules/fakemeta/forward.cpp | 2 -- modules/fakemeta/forward.h | 1 - modules/fakemeta/forwardmacros.h | 14 +++++++------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/modules/fakemeta/forward.cpp b/modules/fakemeta/forward.cpp index 47025adb..82d8cb86 100644 --- a/modules/fakemeta/forward.cpp +++ b/modules/fakemeta/forward.cpp @@ -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; } diff --git a/modules/fakemeta/forward.h b/modules/fakemeta/forward.h index 132e9232..1194fb9f 100644 --- a/modules/fakemeta/forward.h +++ b/modules/fakemeta/forward.h @@ -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 diff --git a/modules/fakemeta/forwardmacros.h b/modules/fakemeta/forwardmacros.h index 83c5976e..df46b63c 100644 --- a/modules/fakemeta/forwardmacros.h +++ b/modules/fakemeta/forwardmacros.h @@ -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) { \ - 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))); \ + 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))); \ 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