]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - trek/compkl.c
speed limit 80
[bsdgames-darwin.git] / trek / compkl.c
index 1850d78e774006d63297887fa2a966c6407a6cbb..f86749ddab6bb6af2a385f7840d786c2dc613c8f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: compkl.c,v 1.7 2009/05/24 19:18:44 dholland Exp $      */
+/*     $NetBSD: compkl.c,v 1.8 2009/05/24 21:44:56 dholland Exp $      */
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)compkl.c   8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: compkl.c,v 1.7 2009/05/24 19:18:44 dholland Exp $");
+__RCSID("$NetBSD: compkl.c,v 1.8 2009/05/24 21:44:56 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -65,8 +65,7 @@ compkldist(int f)
 
        if (Etc.nkling == 0)
                return;
-       for (i = 0; i < Etc.nkling; i++)
-       {
+       for (i = 0; i < Etc.nkling; i++) {
                /* compute distance to the Klingon */
                dx = Ship.sectx - Etc.klingon[i].x;
                dy = Ship.secty - Etc.klingon[i].y;
@@ -74,13 +73,10 @@ compkldist(int f)
                d = sqrt(d);
 
                /* compute average of new and old distances to Klingon */
-               if (!f)
-               {
+               if (!f) {
                        temp = Etc.klingon[i].dist;
                        Etc.klingon[i].avgdist = 0.5 * (temp + d);
-               }
-               else
-               {
+               } else {
                        /* new quadrant: average is current */
                        Etc.klingon[i].avgdist = d;
                }
@@ -106,16 +102,15 @@ sortkl(void)
 
        m = Etc.nkling - 1;
        f = 1;
-       while (f)
-       {
+       while (f) {
                f = 0;
-               for (i = 0; i < m; i++)
-                       if (Etc.klingon[i].dist > Etc.klingon[i+1].dist)
-                       {
+               for (i = 0; i < m; i++) {
+                       if (Etc.klingon[i].dist > Etc.klingon[i+1].dist) {
                                t =  Etc.klingon[i];
                                Etc.klingon[i] = Etc.klingon[i+1];
                                Etc.klingon[i+1] = t;
                                f = 1;
                        }
+               }
        }
 }