]> git.itanic.dy.fi Git - sdl-planets/commitdiff
main.c: Print tree statistics
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 10 Apr 2010 14:42:19 +0000 (17:42 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 10 Apr 2010 14:42:19 +0000 (17:42 +0300)
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
main.c
planet.c

diff --git a/main.c b/main.c
index 88efd2179e76dd40a5f9a62d3ff482b65a2537bf..8be3330f3128802b82ff307062f516478ad39196 100644 (file)
--- a/main.c
+++ b/main.c
@@ -297,10 +297,12 @@ static void loop(SDL_Surface *screen, int num_of_planets, double total_mass,
                        last_fps_time = ticks;
                }
 
-               printf("  \rFrames/s: %.2f, steps/s: %.2f, planets: %d"
-                      ", scale %.2f, zoom %.2f, step %ld, visible %d",
+               printf("  \rfps: %.2f, steps/s: %.2f, planets: %d"
+                      ", scale %.2f, zoom %.2f, step %ld, visible %d,"
+                      " depth %ld, c:%ld",
                       last_fps, last_sps, planets, status.time_scale,
-                      camera.zoom, step_count, visible_planets);
+                      camera.zoom, step_count, visible_planets,
+                      planet_root->tree.depth, planet_root->tree.children);
                fflush(stdout);
 
 
index da83d3a1d491762fb1ae8cbe0196bbae10fd9e06..a51d3cb0f2f39b9dda1a2a15b7a1b409eba9e5c8 100644 (file)
--- a/planet.c
+++ b/planet.c
@@ -214,6 +214,7 @@ struct planet *move_planet(struct planet *p, const double time)
 
        vector_scale(&p->speed, time, &tmp);
        vector_add(&p->pos, &tmp, &p->pos);
+       vector_scale(&p->speed, pow(0.99, time), &p->speed);
 
        tree_parent = quadtree_del(&p->tree, planet_spatial_compare);
        quadtree_add(tree_parent, &p->tree, planet_spatial_compare);