X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=ai.c;h=5865c2931bfac2725d536f51590449ff416146d4;hb=d7ddf0df59133fd0ff3f49d0ed83079e3a695aeb;hp=ad550a14cdecba56c208324c855cc03c2d5b88ad;hpb=49483a1747cd310e33eea758b32a453fb46d4aac;p=super-star-trek.git diff --git a/ai.c b/ai.c index ad550a1..5865c29 100644 --- a/ai.c +++ b/ai.c @@ -3,9 +3,9 @@ static int tryexit(int lookx, int looky, int ienm, int loccom, int irun) { int iqx, iqy, l; - iqx = quadx+(lookx+9)/10 - 1; - iqy = quady+(looky+9)/10 - 1; - if (iqx < 1 || iqx > 8 || iqy < 1 || iqy > 8 || + iqx = quadx+(lookx+(QUADSIZE-1))/QUADSIZE - 1; + iqy = quady+(looky+(QUADSIZE-1))/QUADSIZE - 1; + if (iqx < 1 || iqx > GALSIZE || iqy < 1 || iqy > GALSIZE || game.state.galaxy[iqx][iqy] > 899) return 0; /* no can do -- neg energy, supernovae, or >8 Klingons */ if (ienm == IHR) return 0; /* Romulans cannot escape! */ @@ -302,7 +302,7 @@ static int movescom(int iqx, int iqy, int flag, int *ipage) { int i; if ((iqx==quadx && iqy==quady) || - iqx < 1 || iqx > 8 || iqy < 1 || iqy > 8 || + iqx < 1 || iqx > GALSIZE || iqy < 1 || iqy > GALSIZE || game.state.galaxy[iqx][iqy] > 899) return 1; if (flag) { /* Avoid quadrants with bases if we want to avoid Enterprise */