]> git.itanic.dy.fi Git - sdl-planets/commitdiff
Continuing..
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 23 May 2010 15:16:34 +0000 (18:16 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 23 May 2010 15:21:32 +0000 (18:21 +0300)
quadtree.c

index c7a8d57104fd00d73a2731e54eca206fd250574c..e0342f8dfbc6da84dffe13b298905a45b78d21f6 100644 (file)
@@ -258,24 +258,35 @@ static void relocate_from_list(struct quadtree *start, struct quadtree *end,
        struct quadtree *tmp = start, *node;
        int i, d = nodes / 2;
 
-       while (nodes) {
+       for (i = 0; i < nodes; i++) {
+               printf("Node %p, prev %p, next %p\n",
+                      list_to_tree(&tmp->list), 
+                      list_to_tree(tmp->list.prev),
+                      list_to_tree(tmp->list.next));
+               fflush(stdout);
+               tmp = list_to_tree(tmp->list.next);
+       };
+
+       for (; nodes > 0; nodes--) {
                if (debug) {
                        printf("stepping %d, %d nodes left\n", d, nodes);
                        fflush(stdout);
                }
 
+/*
                for (i = 0; i < d; i++)
                        tmp = list_to_tree(tmp->list.next);
+*/
 
                if (debug) {
-                       printf("Now moving mode %p\n", tmp);
+                       printf("Now moving node %p\n", tmp);
                        fflush(stdout);
                }
+               node = tmp;
+               tmp = list_to_tree(tmp->list.next);
 
-               node = list_to_tree(tmp->list.next);
                list_del(&node->list);
                quadtree_add(parent, node, ops);
-               nodes--;
 
                d /= 2;
                if (d == 0)