From 8b17508ae49d10e2fcc075096bce39bc8489ac7e Mon Sep 17 00:00:00 2001 From: TimeServ Date: Tue, 4 Jan 2005 19:48:26 +0000 Subject: [PATCH] better solution git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@722 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/r_part.c | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/engine/client/r_part.c b/engine/client/r_part.c index 7277fc8b9..6391e753c 100644 --- a/engine/client/r_part.c +++ b/engine/client/r_part.c @@ -305,7 +305,7 @@ void R_ParticleEffect_f(void) char *var, *value; char *buf; particle_t *parts; - beamseg_t *beamsegs, *btemp; + beamseg_t *beamsegs; skytris_t *st; part_type_t *ptype; @@ -350,30 +350,13 @@ void R_ParticleEffect_f(void) ptype->particles = parts; } - // clear beam list.. bit more complex - while (ptype->beams && !(ptype->beams->flags & BS_LASTSEG)) + // go with a lazy clear of list.. mark everything as DEAD and let + // the beam rendering handle removing nodes + beamsegs = ptype->beams; + while (beamsegs) { - beamsegs = ptype->beams->next; - ptype->beams->next = free_beams; - free_beams = ptype->beams; - ptype->beams = beamsegs; - } - - btemp = ptype->beams; - while (btemp) - { - if (btemp->flags & BS_LASTSEG) // prevent runaway pointers - { - btemp->flags |= BS_DEAD; - btemp = btemp->next; - } - else - { - beamsegs = btemp->next; - btemp->next = free_beams; - free_beams = btemp; - btemp = beamsegs; - } + beamsegs->flags |= BS_DEAD; + beamsegs = beamsegs->next; } beamsegs = ptype->beams;