Only add to quadtree if alive.

This commit is contained in:
Steve 2018-02-04 11:00:42 +00:00
parent 78422382e2
commit c4346550cf
1 changed files with 11 additions and 8 deletions

View File

@ -103,11 +103,6 @@ void doEntities(void)
self->riding = NULL;
if (!(self->flags & (EF_TELEPORTING | EF_GONE)))
{
addToQuadtree(self, &world.quadtree);
}
if (self->isOnScreen)
{
memset(touched, 0, sizeof(Entity*) * MAX_TOUCHED);
@ -178,12 +173,20 @@ void doEntities(void)
self->isOnScreen = 0;
}
if (self->alive == ALIVE_ALIVE && self->health <= 0)
if (self->alive == ALIVE_ALIVE)
{
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)
{
prev->next = self->next;