From c0d73ce572f9dd33f1f6405c58bd9d05bd3838cf Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 5 Sep 2004 20:03:01 +0000 Subject: [PATCH] Fixed a bug where SP forwards were not unregistered Fixed a bug where pfn_touch might not be called correctly --- dlls/engine/amxxapi.cpp | 5 ++++- dlls/engine/engine.h | 7 +++++++ dlls/engine/forwards.cpp | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/engine/amxxapi.cpp b/dlls/engine/amxxapi.cpp index a5d2a57e..58ad9d6e 100755 --- a/dlls/engine/amxxapi.cpp +++ b/dlls/engine/amxxapi.cpp @@ -236,8 +236,11 @@ void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax) for(int f = 1; f <= gpGlobals->maxClients;f++) g_player_edicts[f]=pEdictList + f; Msg.clear(); - register int i = 0; + register int i = 0, j = 0; for (i=0; i<256; i++) { + for (j=0; j<256; j++) + if (msgHooks[i].at(j) != -1) + MF_UnregisterSPForward(msgHooks[i].at(j)); msgHooks[i].clear(); msgBlocks[i] = 0; } diff --git a/dlls/engine/engine.h b/dlls/engine/engine.h index 98e1ca89..40dcedb9 100755 --- a/dlls/engine/engine.h +++ b/dlls/engine/engine.h @@ -120,6 +120,11 @@ struct GlobalInfo { class Impulse { public: + ~Impulse() + { + if (Forward != -1) + MF_UnregisterSPForward(Forward); + } int Forward; int Check; }; @@ -140,6 +145,8 @@ public: delete [] Touched; Touched = 0; } + if (Forward != -1) + MF_UnregisterSPForward(Forward); } }; diff --git a/dlls/engine/forwards.cpp b/dlls/engine/forwards.cpp index 51acd6d1..f17b1851 100755 --- a/dlls/engine/forwards.cpp +++ b/dlls/engine/forwards.cpp @@ -267,7 +267,8 @@ void pfnTouch(edict_t *pToucher, edict_t *pTouched) retVal = MF_ExecuteForward(pfnTouchForward, ENTINDEX(pToucher), ENTINDEX(pTouched)); if (retVal) RETURN_META(MRES_SUPERCEDE); - } else if (VexdTouchForward != -1) { + } + if (VexdTouchForward != -1) { retVal = MF_ExecuteForward(VexdTouchForward, ENTINDEX(pToucher), ENTINDEX(pTouched)); if (retVal) RETURN_META(MRES_SUPERCEDE);