Removed redundant calls.

This commit is contained in:
Steve 2016-02-22 21:45:02 +00:00
parent e99159f3ea
commit bde4dd84f5
1 changed files with 6 additions and 12 deletions

View File

@ -191,26 +191,20 @@ static int getIndex(Quadtree *root, int x, int y, int w, int h)
void removeFromQuadtree(Entity *e, Quadtree *root) void removeFromQuadtree(Entity *e, Quadtree *root)
{ {
int index, i; int index;
index = getIndex(root, e->x - (e->w / 2), e->y - (e->h / 2), e->w, e->h);
removeEntity(e, root);
if (root->node[0]) if (root->node[0])
{ {
index = getIndex(root, e->x - (e->w / 2), e->y - (e->h / 2), e->w, e->h);
if (index != -1) if (index != -1)
{ {
removeFromQuadtree(e, root->node[index]); removeFromQuadtree(e, root->node[index]);
} return;
else
{
for (i = 0; i < 4; i++)
{
removeFromQuadtree(e, root->node[i]);
}
} }
} }
removeEntity(e, root);
} }
static void removeEntity(Entity *e, Quadtree *root) static void removeEntity(Entity *e, Quadtree *root)