Fixed a bug where SP forwards were not unregistered

Fixed a bug where pfn_touch might not be called correctly
This commit is contained in:
David Anderson 2004-09-05 20:03:01 +00:00
parent 7d3d04b13d
commit c0d73ce572
3 changed files with 13 additions and 2 deletions

View File

@ -236,8 +236,11 @@ void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
for(int f = 1; f <= gpGlobals->maxClients;f++) for(int f = 1; f <= gpGlobals->maxClients;f++)
g_player_edicts[f]=pEdictList + f; g_player_edicts[f]=pEdictList + f;
Msg.clear(); Msg.clear();
register int i = 0; register int i = 0, j = 0;
for (i=0; i<256; i++) { 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(); msgHooks[i].clear();
msgBlocks[i] = 0; msgBlocks[i] = 0;
} }

View File

@ -120,6 +120,11 @@ struct GlobalInfo {
class Impulse class Impulse
{ {
public: public:
~Impulse()
{
if (Forward != -1)
MF_UnregisterSPForward(Forward);
}
int Forward; int Forward;
int Check; int Check;
}; };
@ -140,6 +145,8 @@ public:
delete [] Touched; delete [] Touched;
Touched = 0; Touched = 0;
} }
if (Forward != -1)
MF_UnregisterSPForward(Forward);
} }
}; };

View File

@ -267,7 +267,8 @@ void pfnTouch(edict_t *pToucher, edict_t *pTouched)
retVal = MF_ExecuteForward(pfnTouchForward, ENTINDEX(pToucher), ENTINDEX(pTouched)); retVal = MF_ExecuteForward(pfnTouchForward, ENTINDEX(pToucher), ENTINDEX(pTouched));
if (retVal) if (retVal)
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
} else if (VexdTouchForward != -1) { }
if (VexdTouchForward != -1) {
retVal = MF_ExecuteForward(VexdTouchForward, ENTINDEX(pToucher), ENTINDEX(pTouched)); retVal = MF_ExecuteForward(VexdTouchForward, ENTINDEX(pToucher), ENTINDEX(pTouched));
if (retVal) if (retVal)
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);