More magic-number chasing.
[super-star-trek.git] / battle.c
index 9b35e4f0ad838da1523e79f5a4852a83350eeeef..36a6cfa7a126273f4de9cd872c3dc5a56a94418c 100644 (file)
--- a/battle.c
+++ b/battle.c
@@ -193,17 +193,17 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait, i
        for (l=1; l <= 15; l++) {
                x += deltax;
                ix = x + 0.5;
-               if (ix < 1 || ix > 10) break;
+               if (ix < 1 || ix > QUADSIZE) break;
                y += deltay;
                iy = y + 0.5;
-               if (iy < 1 || iy > 10) break;
+               if (iy < 1 || iy > QUADSIZE) break;
                iquad=game.quad[ix][iy];
                tracktorpedo(x, y, ix, iy, wait, l, i, n, iquad);
                wait = 1;
                if (iquad==IHDOT) continue;
                /* hit something */
                setwnd(message_window);
-               prout("");      /* start new line after text track */
+               skip(1);        /* start new line after text track */
                switch(iquad) {
                        case IHE: /* Hit our ship */
                        case IHF:
@@ -225,7 +225,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait, i
                                yy = cos(ang)/temp;
                                jx=ix+xx+0.5;
                                jy=iy+yy+0.5;
-                               if (jx<1 || jx>10 || jy<1 ||jy > 10) return;
+                               if (jx<1 || jx>QUADSIZE || jy<1 ||jy > QUADSIZE) return;
                                if (game.quad[jx][jy]==IHBLANK) {
                                        finish(FHOLE);
                                        return;
@@ -273,7 +273,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait, i
                                yy = cos(ang)/temp;
                                jx=ix+xx+0.5;
                                jy=iy+yy+0.5;
-                               if (jx<1 || jx>10 || jy<1 ||jy > 10) {
+                               if (jx<1 || jx>QUADSIZE || jy<1 ||jy > QUADSIZE) {
                                        prout(" damaged but not destroyed.");
                                        return;
                                }
@@ -306,7 +306,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int wait, i
                                game.quad[ix][iy]=IHDOT;
                                game.state.rembase--;
                                basex=basey=0;
-                               game.state.galaxy[quadx][quady] -= 10;
+                               game.state.galaxy[quadx][quady] -= BASE_PLACE;
                                game.state.basekl++;
                                newcnd();
                                return;
@@ -513,7 +513,7 @@ void attack(int k) {
                        r += 0.002*game.kpower[l]*r;
                        torpedo(course, r, jx, jy, &hit, 0, 1, 1);
                        if (game.state.remkl==0) finish(FWON); /* Klingons did themselves in! */
-                       if (game.state.galaxy[quadx][quady] == 1000 ||
+                       if (game.state.galaxy[quadx][quady] == SUPERNOVA_PLACE ||
                                alldone) return; /* Supernova or finished */
                        if (hit == 0) continue;
                }
@@ -602,7 +602,7 @@ void deadkl(int ix, int iy, int type, int ixx, int iyy) {
        /* Decide what kind of enemy it is and update approriately */
        if (type == IHR) {
                /* chalk up a Romulan */
-               game.state.newstuf[quadx][quady] -= 10;
+               game.state.newstuf[quadx][quady] -= ROMULAN_PLACE;
                irhere--;
                game.state.nromkl++;
                game.state.nromrem--;
@@ -678,7 +678,7 @@ void deadkl(int ix, int iy, int type, int ixx, int iyy) {
 static int targetcheck(double x, double y, double *course) {
        double deltx, delty;
        /* Return TRUE if target is invalid */
-       if (x < 1.0 || x > 10.0 || y < 1.0 || y > 10.0) {
+       if (x < 1.0 || x > QUADSIZE || y < 1.0 || y > QUADSIZE) {
                huh();
                return 1;
        }