Revert "applied a better fix for the infamous "SV_TouchLinks: next != l->next" problem."

This reverts r359

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1483 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Eric Wasylishen 2017-08-28 02:15:02 +00:00
parent df1c7ee3ff
commit 73123e19cb

View file

@ -265,18 +265,11 @@ SV_UnlinkEdict
=============== ===============
*/ */
static link_t **sv_link_next;
static link_t **sv_link_prev;
void SV_UnlinkEdict (edict_t *ent) void SV_UnlinkEdict (edict_t *ent)
{ {
if (!ent->area.prev) if (!ent->area.prev)
return; // not linked in anywhere return; // not linked in anywhere
RemoveLink (&ent->area); RemoveLink (&ent->area);
if (sv_link_next && *sv_link_next == &ent->area)
*sv_link_next = ent->area.next;
if (sv_link_prev && *sv_link_prev == &ent->area)
*sv_link_prev = ent->area.prev;
ent->area.prev = ent->area.next = NULL; ent->area.prev = ent->area.next = NULL;
} }
@ -293,15 +286,15 @@ void SV_TouchLinks ( edict_t *ent, areanode_t *node )
int old_self, old_other; int old_self, old_other;
// touch linked edicts // touch linked edicts
sv_link_next = &next;
for (l = node->trigger_edicts.next ; l != &node->trigger_edicts ; l = next) for (l = node->trigger_edicts.next ; l != &node->trigger_edicts ; l = next)
{ {
//johnfitz -- fixes a crash when a touch function deletes an entity which comes later in the list
if (!l) if (!l)
{ {
// my area got removed out from under me! Con_Printf ("SV_TouchLinks: null link\n");
Con_Printf ("SV_TouchLinks: encountered NULL link!\n");
break; break;
} }
//johnfitz
next = l->next; next = l->next;
touch = EDICT_FROM_AREA(l); touch = EDICT_FROM_AREA(l);
@ -324,12 +317,18 @@ void SV_TouchLinks ( edict_t *ent, areanode_t *node )
pr_global_struct->time = sv.time; pr_global_struct->time = sv.time;
PR_ExecuteProgram (touch->v.touch); PR_ExecuteProgram (touch->v.touch);
//johnfitz -- the PR_ExecuteProgram above can alter the linked edicts -- fix from tyrquake
if (next != l->next && l->next)
{
Con_Printf ("SV_TouchLinks: next != l->next\n");
next = l->next;
}
//johnfitz
pr_global_struct->self = old_self; pr_global_struct->self = old_self;
pr_global_struct->other = old_other; pr_global_struct->other = old_other;
} }
sv_link_next = NULL;
// recurse down both sides // recurse down both sides
if (node->axis == -1) if (node->axis == -1)
return; return;