]> git.itanic.dy.fi Git - sdl-planets/commitdiff
planet.c: Make line drawing conditional
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 17 Apr 2010 14:11:59 +0000 (17:11 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 17 Apr 2010 14:16:35 +0000 (17:16 +0300)
planet.c

index ee867b32866c060a6b835926e3bfaaf4cd439709..99e6e312bcae1870f5686acd1566c9bbd4275c51 100644 (file)
--- a/planet.c
+++ b/planet.c
@@ -7,6 +7,8 @@
 struct quadtree_ops planet_ops;
 int gravitations, optimizations;
 
+static int draw_lines = 0;
+
 static void putpixel(struct SDL_Surface *screen, const int x, const int y,
                     const unsigned char r, const unsigned char g,
                     const unsigned char b)
@@ -183,15 +185,16 @@ void draw_planet(SDL_Surface *screen, const struct planet *p,
        pos.x += screen->w / 2;
        pos.y += screen->h / 2;
 
+       if (draw_lines) {
+               for (i = 0; i < 4; i++) {
+                       if (!p->tree.child[i])
+                               continue;
 
-       for (i = 0; i < 4; i++) {
-               if (!p->tree.child[i])
-                       continue;
-
-               struct planet *q = tree_to_planet(p->tree.child[i]);
+                       struct planet *q = tree_to_planet(p->tree.child[i]);
 
-               draw_line(screen, &p->pos, &q->pos,
-                         p->r, p->g, p->b, cam);
+                       draw_line(screen, &p->pos, &q->pos,
+                                 p->r, p->g, p->b, cam);
+               }
        }
 
        draw_circle(screen, &pos, radius, p->r, p->g, p->b, 0);