diff options
author | Vito Caputo <vcaputo@gnugeneration.com> | 2017-01-07 18:40:38 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@gnugeneration.com> | 2017-01-07 18:40:38 -0800 |
commit | dacd3f84c7d8057e8f7a22f4e08cd37f51064cb7 (patch) | |
tree | f72e0011d46271b01e0775fbae58298ecc3da07c /modules | |
parent | 871a8546e2146443166a30cb9f5c267d444f5a45 (diff) |
sparkler: don't age or sim on empty children either
More of 86bc322, eliminate per-particle unnecessary calls
Diffstat (limited to 'modules')
-rw-r--r-- | modules/sparkler/particles.c | 7 |
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); + } } } |