mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-10 17:50:48 +00:00
applied a better fix for the infamous "SV_TouchLinks: next != l->next" problem.
Fixes "whiteroom" (http://www.quaddicted.com/reviews/whiteroom.html) completely locking the engine. fix from the quakeforge sources. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@359 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
b322f347be
commit
b94fea30fb
1 changed files with 12 additions and 11 deletions
|
@ -262,11 +262,18 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,15 +290,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)
|
||||||
{
|
{
|
||||||
Con_Printf ("SV_TouchLinks: null link\n");
|
// my area got removed out from under me!
|
||||||
|
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);
|
||||||
|
@ -314,18 +321,12 @@ 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;
|
||||||
|
|
Loading…
Reference in a new issue