-static int planet_search_when_moving(struct quadtree *node,
- struct quadtree_iterator *itr)
-{
- struct planet *p = tree_to_planet(node);
- struct planet_search_iterator *it = qt_itr_to_planet_itr(itr);
- int direction = 0, i;
- int up = 0, left = 0, right = 0, down = 0;
-
- for (i = 0; i < 2; i++) {
- if (it->limit[i].x < p->tree.pos.x)
- left = 1;
- else
- right = 1;
- if (it->limit[i].y < p->tree.pos.y)
- up = 1;
- else
- down = 1;
- }
-
- if (left || up)
- direction |= QUADTREE_UPLEFT;
- if (right || up)
- direction |= QUADTREE_UPRIGHT;
- if (left || down)
- direction |= QUADTREE_DOWNLEFT;
- if (right || down)
- direction |= QUADTREE_DOWNRIGHT;
- if ((left && right) || (up && down))
- direction |= QUADTREE_SELF;
-
- return direction;
-}
-
-void planet_move_iterator(struct quadtree *node, struct quadtree_iterator *it)
-{
- struct quadtree *parent;
-
- if (node == it->head)
- return;
-
- parent = quadtree_del(node, &planet_ops);
- quadtree_add(parent, node, &planet_ops);
-}
-