summaryrefslogtreecommitdiff
path: root/modules/sparkler
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@gnugeneration.com>2017-01-07 18:40:38 -0800
committerVito Caputo <vcaputo@gnugeneration.com>2017-01-07 18:40:38 -0800
commitdacd3f84c7d8057e8f7a22f4e08cd37f51064cb7 (patch)
treef72e0011d46271b01e0775fbae58298ecc3da07c /modules/sparkler
parent871a8546e2146443166a30cb9f5c267d444f5a45 (diff)
sparkler: don't age or sim on empty children either
More of 86bc322, eliminate per-particle unnecessary calls
Diffstat (limited to 'modules/sparkler')
-rw-r--r--modules/sparkler/particles.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/sparkler/particles.c b/modules/sparkler/particles.c
index bb431a6..69f55dd 100644
--- a/modules/sparkler/particles.c
+++ b/modules/sparkler/particles.c
@@ -260,7 +260,8 @@ static inline particle_status_t _particles_sim(particles_t *particles, list_head
if ((s = particle_sim(particles, &p->public)) == PARTICLE_ALIVE) {
ret = PARTICLE_ALIVE;
- if (_particles_sim(particles, &p->children) == PARTICLE_ALIVE) {
+ if (!list_empty(&p->children) &&
+ _particles_sim(particles, &p->children) == PARTICLE_ALIVE) {
ret = PARTICLE_ALIVE;
}
} else {
@@ -326,7 +327,9 @@ static inline void _particles_age(particles_t *particles, list_head_t *list)
bsp_move_occupant(particles->bsp, &p->public.occupant, &p->props.position);
}
- _particles_age(particles, &p->children);
+ if (!list_empty(&p->children)) {
+ _particles_age(particles, &p->children);
+ }
}
}
© All Rights Reserved