X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Fai.c;h=66b50d7165ded56ef8d606e8f368760c8f96b21b;hp=99024df9acddcd8b0c05c7ae222de6fad5ee2f9d;hb=9aef5f5aae5fde0ed2b462945750c7aee59b3c1e;hpb=9ae916e9144e84ef1de4a86ea73a45a2bc4cc1be diff --git a/src/ai.c b/src/ai.c index 99024df..66b50d7 100644 --- a/src/ai.c +++ b/src/ai.c @@ -267,7 +267,7 @@ static void movebaddy(coord com, int loccom, feature ienm) } } -void movcom(void) +void moveklings(void) /* move a commander */ { coord w; @@ -307,7 +307,7 @@ void movcom(void) sortkl(); } -static bool movescom(coord iq, bool flag, bool *ipage) +static bool movescom(coord iq, bool flag) /* commander movement helper */ { int i; @@ -351,15 +351,13 @@ static bool movescom(coord iq, bool flag, bool *ipage) } /* check for a helpful planet */ for (i = 0; i < game.inplan; i++) { - if (same(game.state.plnets[i].w, game.state.kscmdr) && - game.state.plnets[i].crystals == present) { + if (same(game.state.planets[i].w, game.state.kscmdr) && + game.state.planets[i].crystals == present) { /* destroy the planet */ - DESTROY(&game.state.plnets[i]); + DESTROY(&game.state.planets[i]); game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].planet = NOPLANET; if (!damaged(DRADIO) || game.condition == docked) { - if (!*ipage) - pause_game(true); - *ipage = true; + pause_game(true); prout(_("Lt. Uhura- \"Captain, Starfleet Intelligence reports")); proutn(_(" a planet in ")); proutn(cramlc(quadrant, game.state.kscmdr)); @@ -372,7 +370,7 @@ static bool movescom(coord iq, bool flag, bool *ipage) return false; /* looks good! */ } -void scom(bool *ipage) +void scom(void) /* move the Super Commander */ { int i, i2, j, ideltax, ideltay, ifindit, iwhichb; @@ -472,32 +470,32 @@ void scom(bool *ipage) /* try moving in both x and y directions */ iq.x = game.state.kscmdr.x + ideltax; iq.y = game.state.kscmdr.y + ideltax; - if (movescom(iq, flag, ipage)) { + if (movescom(iq, flag)) { /* failed -- try some other maneuvers */ if (ideltax==0 || ideltay==0) { /* attempt angle move */ if (ideltax != 0) { iq.y = game.state.kscmdr.y + 1; - if (movescom(iq, flag, ipage)) { + if (movescom(iq, flag)) { iq.y = game.state.kscmdr.y - 1; - movescom(iq, flag, ipage); + movescom(iq, flag); } } else { iq.x = game.state.kscmdr.x + 1; - if (movescom(iq, flag, ipage)) { + if (movescom(iq, flag)) { iq.x = game.state.kscmdr.x - 1; - movescom(iq, flag, ipage); + movescom(iq, flag); } } } else { /* try moving just in x or y */ iq.y = game.state.kscmdr.y; - if (movescom(iq, flag, ipage)) { + if (movescom(iq, flag)) { iq.y = game.state.kscmdr.y + ideltay; iq.x = game.state.kscmdr.x; - movescom(iq, flag, ipage); + movescom(iq, flag); } } } @@ -518,9 +516,7 @@ void scom(bool *ipage) if (damaged(DRADIO) && game.condition != docked) return; /* no warning */ game.iseenit = true; - if (!*ipage) - pause_game(true); - *ipage = true; + pause_game(true); proutn(_("Lt. Uhura- \"Captain, the starbase in ")); proutn(cramlc(quadrant, game.state.kscmdr)); skip(1); @@ -544,9 +540,7 @@ void scom(bool *ipage) (damaged(DRADIO) && game.condition != docked) || !game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].charted)) return; - if (!*ipage) - pause_game(true); - *ipage = true; + pause_game(true); prout(_("Lt. Uhura- \"Captain, Starfleet Intelligence reports")); proutn(_(" the Super-commander is in ")); proutn(cramlc(quadrant, game.state.kscmdr));