]> git.itanic.dy.fi Git - sdl-planets/commitdiff
quadtree: Unlink parent when rebalancing a subtree
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Wed, 13 Jul 2011 16:53:08 +0000 (19:53 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Wed, 13 Jul 2011 17:05:06 +0000 (20:05 +0300)
There is no need to keep the one way link to the parent while the
subtree is being rebalanced. Removing this link optimizes the
rebalancing process by stopping the stats recalculation from
propagating into the parent tree.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
quadtree.c

index 30e306ed58983d70a371e2007063cb6bfc6332f8..1cb97563874d51770f73a89c7183883d934dbd43 100644 (file)
@@ -688,6 +688,7 @@ struct quadtree *quadtree_del(struct quadtree *node,
                        trap();
 
                parent = node->parent;
+               node->parent = NULL;
 
                /*
                 * The sub branch is now detached from the main