X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=ai.c;h=f1eca73a58c3614408429158dd4e3d99f45ba539;hp=c6a862ea25c2c4ff01ae63af5db386c21b163533;hb=bdcf85461c171a9263fb0ba0e0ec07661bd082f5;hpb=65b9a64fa507a2ec318ffaea1d8fdb070245c581 diff --git a/ai.c b/ai.c index c6a862e..f1eca73 100644 --- a/ai.c +++ b/ai.c @@ -6,7 +6,7 @@ static int tryexit(int lookx, int looky, int ienm, int loccom, int irun) iqx = quadx+(lookx+(QUADSIZE-1))/QUADSIZE - 1; iqy = quady+(looky+(QUADSIZE-1))/QUADSIZE - 1; - if (iqx < 1 || iqx > GALSIZE || iqy < 1 || iqy > GALSIZE || + if (!VALID_QUADRANT(iqx,iqy) || game.state.galaxy[iqx][iqy].supernova || game.state.galaxy[iqx][iqy].klingons > 8) return 0; /* no can do -- neg energy, supernovae, or >8 Klingons */ @@ -307,7 +307,7 @@ static int movescom(int iqx, int iqy, int flag, int *ipage) int i; if ((iqx==quadx && iqy==quady) || - iqx < 1 || iqx > GALSIZE || iqy < 1 || iqy > GALSIZE || + !VALID_QUADRANT(iqx, iqy) || game.state.galaxy[iqx][iqy].supernova || game.state.galaxy[iqx][iqy].klingons > 8) return 1; @@ -595,7 +595,7 @@ void movetho(void) game.ky[nenhere]=ithy; /* check to see if all holes plugged */ - for (i = 1; i < QUADSIZE+1; i++) { + for_sectors(i) { if (game.quad[1][i]!=IHWEB && game.quad[1][i]!=IHT) return; if (game.quad[QUADSIZE][i]!=IHWEB && game.quad[QUADSIZE][i]!=IHT) return; if (game.quad[i][1]!=IHWEB && game.quad[i][1]!=IHT) return;