From 842813dcbb0d68f6e3000bbd5961e36282d72cee Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 23 Jul 2005 20:16:29 +0000 Subject: [PATCH] Fixed a few potential bugs, and set_msg_arg* no longer accepts type changes --- dlls/engine/amxxapi.cpp | 11 +++-------- dlls/engine/engine.cpp | 1 - dlls/engine/forwards.cpp | 14 ++++++++------ dlls/engine/messages.cpp | 4 ++-- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/dlls/engine/amxxapi.cpp b/dlls/engine/amxxapi.cpp index 8d3f302c..cbb37fb2 100755 --- a/dlls/engine/amxxapi.cpp +++ b/dlls/engine/amxxapi.cpp @@ -26,6 +26,9 @@ void ClearHooks() for (i=0; imaxClients;f++) g_player_edicts[f]=pEdictList + f; - register int i = 0, j = 0; - for (i=0; i<256; i++) { - for (j=0; j<(int)msgHooks[i].size(); j++) - if (msgHooks[i].at(j) != -1) - MF_UnregisterSPForward(msgHooks[i].at(j)); - msgHooks[i].clear(); - msgBlocks[i] = 0; - } RETURN_META(MRES_IGNORED); } diff --git a/dlls/engine/engine.cpp b/dlls/engine/engine.cpp index 833ef0d3..e36cc9b0 100755 --- a/dlls/engine/engine.cpp +++ b/dlls/engine/engine.cpp @@ -11,7 +11,6 @@ TraceResult g_tr; #define BUFFERSIZE 1023 char g_buffer[BUFFERSIZE + 1]; - void UTIL_SetSize(edict_t *pev, const Vector &vecMin, const Vector &vecMax) { SET_SIZE(ENT(pev), vecMin, vecMax); diff --git a/dlls/engine/forwards.cpp b/dlls/engine/forwards.cpp index d58294f3..423ba8d0 100755 --- a/dlls/engine/forwards.cpp +++ b/dlls/engine/forwards.cpp @@ -232,6 +232,8 @@ void pfnTouch(edict_t *pToucher, edict_t *pTouched) int retVal = 0; const char *ptrClass = STRING(pToucher->v.classname); const char *ptdClass = STRING(pTouched->v.classname); + int ptrIndex = ENTINDEX(pToucher); + int ptdIndex = ENTINDEX(pTouched); META_RES res=MRES_IGNORED; for (i=0; iTouched.size() == 0) { - retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched)); + retVal = MF_ExecuteForward(Touches[i]->Forward, ptrIndex, ptdIndex); if (retVal & 2/*PLUGIN_HANDLED_MAIN*/) RETURN_META(MRES_SUPERCEDE); else if (retVal) res=MRES_SUPERCEDE; } else if (Touches[i]->Touched.compare(ptdClass)==0) { - retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched)); + retVal = MF_ExecuteForward(Touches[i]->Forward, ptrIndex, ptdIndex); if (retVal & 2/*PLUGIN_HANDLED_MAIN*/) RETURN_META(MRES_SUPERCEDE); else if (retVal) @@ -254,13 +256,13 @@ void pfnTouch(edict_t *pToucher, edict_t *pTouched) } else if (Touches[i]->Toucher.compare(ptrClass)==0) { if (Touches[i]->Touched.size() == 0) { - retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched)); + retVal = MF_ExecuteForward(Touches[i]->Forward, ptrIndex, ptdIndex); if (retVal & 2/*PLUGIN_HANDLED_MAIN*/) RETURN_META(MRES_SUPERCEDE); else if (retVal) res=MRES_SUPERCEDE; } else if (Touches[i]->Touched.compare(ptdClass)==0) { - retVal = MF_ExecuteForward(Touches[i]->Forward, ENTINDEX(pToucher), ENTINDEX(pTouched)); + retVal = MF_ExecuteForward(Touches[i]->Forward, ptrIndex, ptdIndex); if (retVal & 2/*PLUGIN_HANDLED_MAIN*/) RETURN_META(MRES_SUPERCEDE); else if (retVal) @@ -270,12 +272,12 @@ void pfnTouch(edict_t *pToucher, edict_t *pTouched) } /* Execute pfnTouch forwards */ if (pfnTouchForward != -1) { - retVal = MF_ExecuteForward(pfnTouchForward, ENTINDEX(pToucher), ENTINDEX(pTouched)); + retVal = MF_ExecuteForward(pfnTouchForward, ptrIndex, ptdIndex); if (retVal) RETURN_META(MRES_SUPERCEDE); } if (VexdTouchForward != -1) { - retVal = MF_ExecuteForward(VexdTouchForward, ENTINDEX(pToucher), ENTINDEX(pTouched)); + retVal = MF_ExecuteForward(VexdTouchForward, ptrIndex, ptdIndex); if (retVal) RETURN_META(MRES_SUPERCEDE); } diff --git a/dlls/engine/messages.cpp b/dlls/engine/messages.cpp index e5649055..355e339a 100755 --- a/dlls/engine/messages.cpp +++ b/dlls/engine/messages.cpp @@ -400,7 +400,7 @@ static cell AMX_NATIVE_CALL set_msg_arg_int(AMX *amx, cell *params) return 0; } - Msg.SetParam(argn, params[2]); + Msg.SetParam(argn, params[3]); return 1; } @@ -428,7 +428,7 @@ static cell AMX_NATIVE_CALL set_msg_arg_float(AMX *amx, cell *params) return 0; } - REAL fVal = amx_ctof(params[2]); + REAL fVal = amx_ctof(params[3]); Msg.SetParam(argn, fVal);