X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=battle.c;fp=battle.c;h=ef45ca275b001e9158f1f5a745920e09535c3f3e;hp=5356e3d14f9f11a1bdcb6a7ed057dc8d20274610;hb=bdcf85461c171a9263fb0ba0e0ec07661bd082f5;hpb=65b9a64fa507a2ec318ffaea1d8fdb070245c581 diff --git a/battle.c b/battle.c index 5356e3d..ef45ca2 100644 --- 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; } @@ -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; }