From c4346550cf2dc72a1a8daadff89c3a190c8351e0 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 4 Feb 2018 11:00:42 +0000 Subject: [PATCH] Only add to quadtree if alive. --- src/world/entities.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/world/entities.c b/src/world/entities.c index 4a34ee3..e17c3d6 100644 --- a/src/world/entities.c +++ b/src/world/entities.c @@ -102,11 +102,6 @@ void doEntities(void) } self->riding = NULL; - - if (!(self->flags & (EF_TELEPORTING | EF_GONE))) - { - addToQuadtree(self, &world.quadtree); - } if (self->isOnScreen) { @@ -178,10 +173,18 @@ void doEntities(void) self->isOnScreen = 0; } - if (self->alive == ALIVE_ALIVE && self->health <= 0) + if (self->alive == ALIVE_ALIVE) { - self->alive = ALIVE_DYING; - self->die(); + if (self->health <= 0) + { + self->alive = ALIVE_DYING; + self->die(); + } + + if (!(self->flags & (EF_TELEPORTING | EF_GONE))) + { + addToQuadtree(self, &world.quadtree); + } } if (self->alive == ALIVE_DEAD)