Fixed a few potential bugs, and set_msg_arg* no longer accepts type changes

This commit is contained in:
David Anderson 2005-07-23 20:16:29 +00:00
parent 9e194394c3
commit 842813dcbb
4 changed files with 13 additions and 17 deletions

View File

@ -26,6 +26,9 @@ void ClearHooks()
for (i=0; i<Thinks.size(); i++)
delete Thinks[i];
for (i=0; i<256; i++)
msgHooks[i].clear();
Touches.clear();
Impulses.clear();
Thinks.clear();
@ -225,14 +228,6 @@ void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
{
for(int f = 1; f <= gpGlobals->maxClients;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);
}

View File

@ -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);

View File

@ -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; i<Touches.size(); i++)
{
@ -239,13 +241,13 @@ void pfnTouch(edict_t *pToucher, edict_t *pTouched)
{
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)
@ -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);
}

View File

@ -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);