Hide more origin differences.
[super-star-trek.git] / battle.c
index 5356e3d14f9f11a1bdcb6a7ed057dc8d20274610..549039999cdbf594490e157a670a81c466325d2b 100644 (file)
--- a/battle.c
+++ b/battle.c
@@ -198,10 +198,9 @@ 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 > QUADSIZE) break;
        y += deltay;
        iy = y + 0.5;
-       if (iy < 1 || iy > QUADSIZE) break;
+       if (!VALID_SECTOR(ix, iy)) break;
        iquad=game.quad[ix][iy];
        tracktorpedo(x, y, ix, iy, wait, l, i, n, iquad);
        wait = 1;
@@ -230,7 +229,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>QUADSIZE || jy<1 ||jy > QUADSIZE) return;
+           if (!VALID_SECTOR(jx, jy)) return;
            if (game.quad[jx][jy]==IHBLANK) {
                finish(FHOLE);
                return;
@@ -278,7 +277,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>QUADSIZE || jy<1 ||jy > QUADSIZE) {
+           if (!VALID_SECTOR(jx, jy)) {
                prout(" damaged but not destroyed.");
                return;
            }
@@ -634,7 +633,7 @@ void deadkl(int ix, int iy, int type, int ixx, int iyy)
        switch (type) {
        case IHC:
            comhere = 0;
-           for (i=1; i<=game.state.remcom; i++)
+           for_commanders (i)
                if (game.state.cx[i]==quadx && game.state.cy[i]==quady) break;
            game.state.cx[i] = game.state.cx[game.state.remcom];
            game.state.cy[i] = game.state.cy[game.state.remcom];
@@ -690,7 +689,7 @@ static int targetcheck(double x, double y, double *course)
 {
     double deltx, delty;
     /* Return TRUE if target is invalid */
-    if (x < 1.0 || x > QUADSIZE || y < 1.0 || y > QUADSIZE) {
+    if (!VALID_SECTOR(x, y)) {
        huh();
        return 1;
     }