]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - trek/klmove.c
Revert to the original phrasing, but remove the man 8 section reference.
[bsdgames-darwin.git] / trek / klmove.c
index 17d636c99918ab2df1331f34a5e5057c34a035be..4963f6be265c93fc572259a610c7092fe420053d 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: klmove.c,v 1.6 2009/05/24 19:18:44 dholland Exp $      */
+/*     $NetBSD: klmove.c,v 1.9 2009/05/24 22:55:03 dholland Exp $      */
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)klmove.c   8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: klmove.c,v 1.6 2009/05/24 19:18:44 dholland Exp $");
+__RCSID("$NetBSD: klmove.c,v 1.9 2009/05/24 22:55:03 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -78,12 +78,11 @@ klmove(int fl)
        double                  bigger;
        int                     i;
 
-#      ifdef xTRACE
+#ifdef xTRACE
        if (Trace)
                printf("klmove: fl = %d, Etc.nkling = %d\n", fl, Etc.nkling);
-#      endif
-       for (n = 0; n < Etc.nkling; n++)
-       {
+#endif
+       for (n = 0; n < Etc.nkling; n++) {
                k = &Etc.klingon[n];
                i = 100;
                if (fl)
@@ -103,8 +102,7 @@ klmove(int fl)
                        bigger = 1.0;
                dx = dx / bigger + 0.5;
                dy = dy / bigger + 0.5;
-               if (motion < 0)
-               {
+               if (motion < 0) {
                        motion = -motion;
                        dx = -dx;
                        dy = -dy;
@@ -113,12 +111,11 @@ klmove(int fl)
                /* try to move the klingon */
                nextx = k->x;
                nexty = k->y;
-               for (; motion > 0; motion--)
-               {
+               for (; motion > 0; motion--) {
                        lookx = nextx + dx;
                        looky = nexty + dy;
-                       if (lookx < 0 || lookx >= NSECTS || looky < 0 || looky >= NSECTS)
-                       {
+                       if (lookx < 0 || lookx >= NSECTS ||
+                           looky < 0 || looky >= NSECTS) {
                                /* new quadrant */
                                qx = Ship.quadx;
                                qy = Ship.quady;
@@ -132,19 +129,23 @@ klmove(int fl)
                                else
                                        if (looky >= NSECTS)
                                                qy += 1;
-                               if (qx < 0 || qx >= NQUADS || qy < 0 || qy >= NQUADS ||
-                                               Quad[qx][qy].stars < 0 || Quad[qx][qy].klings > MAXKLQUAD - 1)
+                               if (qx < 0 || qx >= NQUADS ||
+                                   qy < 0 || qy >= NQUADS ||
+                                   Quad[qx][qy].stars < 0 ||
+                                   Quad[qx][qy].klings > MAXKLQUAD - 1)
                                        break;
-                               if (!damaged(SRSCAN))
-                               {
-                                       printf("Klingon at %d,%d escapes to quadrant %d,%d\n",
+                               if (!damaged(SRSCAN)) {
+                                       printf("Klingon at %d,%d escapes to "
+                                              "quadrant %d,%d\n",
                                                k->x, k->y, qx, qy);
                                        motion = Quad[qx][qy].scanned;
                                        if (motion >= 0 && motion < 1000)
                                                Quad[qx][qy].scanned += 100;
-                                       motion = Quad[Ship.quadx][Ship.quady].scanned;
+                                       motion = Quad[Ship.quadx][Ship.quady]
+                                               .scanned;
                                        if (motion >= 0 && motion < 1000)
-                                               Quad[Ship.quadx][Ship.quady].scanned -= 100;
+                                               Quad[Ship.quadx][Ship.quady]
+                                                       .scanned -= 100;
                                }
                                Sect[k->x][k->y] = EMPTY;
                                Quad[qx][qy].klings += 1;
@@ -154,17 +155,15 @@ klmove(int fl)
                                k = 0;
                                break;
                        }
-                       if (Sect[lookx][looky] != EMPTY)
-                       {
+                       if (Sect[lookx][looky] != EMPTY) {
                                lookx = nextx + fudgex;
                                if (lookx < 0 || lookx >= NSECTS)
                                        lookx = nextx + dx;
-                               if (Sect[lookx][looky] != EMPTY)
-                               {
+                               if (Sect[lookx][looky] != EMPTY) {
                                        fudgex = -fudgex;
                                        looky = nexty + fudgey;
-                                       if (looky < 0 || looky >= NSECTS || Sect[lookx][looky] != EMPTY)
-                                       {
+                                       if (looky < 0 || looky >= NSECTS ||
+                                           Sect[lookx][looky] != EMPTY) {
                                                fudgey = -fudgey;
                                                break;
                                        }
@@ -173,8 +172,7 @@ klmove(int fl)
                        nextx = lookx;
                        nexty = looky;
                }
-               if (k && (k->x != nextx || k->y != nexty))
-               {
+               if (k && (k->x != nextx || k->y != nexty)) {
                        if (!damaged(SRSCAN))
                                printf("Klingon at %d,%d moves to %d,%d\n",
                                        k->x, k->y, nextx, nexty);