From ad7de1246263b4852a0f776d496d9b8270427875 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Sat, 10 Apr 2010 17:42:19 +0300 Subject: [PATCH] main.c: Print tree statistics Signed-off-by: Timo Kokkonen --- main.c | 8 +++++--- planet.c | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 88efd21..8be3330 100644 --- 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); diff --git a/planet.c b/planet.c index da83d3a..a51d3cb 100644 --- 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); -- 2.45.0