X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Fai.c;h=dbf65737a7e63d0e18ce5cfcc3911603969c52d2;hp=ead5a8b1d34064d7f22eed52e0dfefb7f67db7bf;hb=c8f91a7e3437017d237a3bad0166054b97206d8d;hpb=c81e0f1dc6cd1fe5c56e9d521ee1d262932e3a2b diff --git a/src/ai.c b/src/ai.c index ead5a8b..dbf6573 100644 --- a/src/ai.c +++ b/src/ai.c @@ -423,10 +423,8 @@ void scom(int *ipage) for_starbases(i2) { i = basetbl[i2]; /* bug in original had it not finding nearest*/ - ibq.x = game.state.baseq[i].x; - ibq.y = game.state.baseq[i].y; - if ((ibq.x == game.quadrant.x && ibq.y == game.quadrant.y) || - (ibq.x == game.battle.x && ibq.y == game.battle.y) || + ibq = game.state.baseq[i]; + if (same(ibq, game.quadrant) || same(ibq, game.battle) || game.state.galaxy[ibq.x][ibq.y].supernova || game.state.galaxy[ibq.x][ibq.y].klingons > 8) continue; @@ -446,8 +444,7 @@ void scom(int *ipage) } } if (ifindit==0) return; /* Nothing suitable -- wait until next time*/ - ibq.x = game.state.baseq[iwhichb].x; - ibq.y = game.state.baseq[iwhichb].y; + ibq = game.state.baseq[iwhichb]; /* decide how to move toward base */ ideltax = ibq.x - game.state.kscmdr.x; ideltay = ibq.y - game.state.kscmdr.y; @@ -587,8 +584,7 @@ void movetho(void) } } game.quad[game.tholian.x][game.tholian.y] = IHT; - game.ks[game.nenhere].x=game.tholian.x; - game.ks[game.nenhere].y=game.tholian.y; + game.ks[game.nenhere] = game.tholian; /* check to see if all holes plugged */ for_sectors(i) {