X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Fmoving.c;h=0d41dd18f10950eac57bfe95845f30a2ffe0de2f;hp=b68c78be3f8ee291f75ce496a76a6cae44a185b3;hb=c873e794bf5a029fef3a5ee5385cc0fec6220fa0;hpb=2e04509ec9be1e3ad2a1f8a7e84552d6896f89ab diff --git a/src/moving.c b/src/moving.c index b68c78b..0d41dd1 100644 --- a/src/moving.c +++ b/src/moving.c @@ -53,7 +53,7 @@ void imove(bool novapush) /* Don't do it if being pushed by Nova */ if (game.nenhere != 0 && !novapush) { newcnd(); - for_local_enemies(m) { + for (m = 1; m <= game.nenhere; m++) { finald = distance(w, game.ks[m]); game.kavgd[m] = 0.5 * (finald + game.kdist[m]); } @@ -109,7 +109,8 @@ void imove(bool novapush) prout(_("YOU WILL BE DESTROYED.")); } /* Compute final position in new quadrant */ - if (trbeam) return; /* Don't bother if we are to be beamed */ + if (trbeam) /* Don't bother if we are to be beamed */ + return; game.quadrant.x = (w.x+(QUADSIZE-1))/QUADSIZE; game.quadrant.y = (w.y+(QUADSIZE-1))/QUADSIZE; game.sector.x = w.x - QUADSIZE*(game.quadrant.x-1); @@ -194,15 +195,16 @@ no_quad_change: /* No quadrant change -- compute new avg enemy distances */ game.quad[game.sector.x][game.sector.y] = game.ship; if (game.nenhere) { - for_local_enemies(m) { + for (m = 1; m <= game.nenhere; m++) { finald = distance(w, game.ks[m]); game.kavgd[m] = 0.5 * (finald+game.kdist[m]); game.kdist[m] = finald; } - sortkl(); + sortklings(); if (!game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova) attack(false); - for_local_enemies(m) game.kavgd[m] = game.kdist[m]; + for (m = 1; m <= game.nenhere; m++) + game.kavgd[m] = game.kdist[m]; } newcnd(); drawmaps(0); @@ -241,7 +243,7 @@ void dock(bool verbose) (is_scheduled(FCDBAS) || game.isatb == 1) && !game.iseenit) { /* get attack report from base */ prout(_("Lt. Uhura- \"Captain, an important message from the starbase:\"")); - attakreport(false); + attackreport(false); game.iseenit = true; } } @@ -249,7 +251,7 @@ void dock(bool verbose) /* * This program originally required input in terms of a (clock) * direction and distance. Somewhere in history, it was changed to - * cartesian coordinates. So we need to convert. I think + * cartesian coordinates. So we need to convert. Probably * "manual" input should still be done this way -- it's a real * pain if the computer isn't working! Manual mode is still confusing * because it involves giving x and y motions, yet the coordinates @@ -267,9 +269,8 @@ static void getcd(bool isprobe, int akey) coord incr; bool iprompt = false; - /* Get course direction and distance. If user types bad values, return - with DIREC = -1.0. */ - + // Get course direction and distance. If user types bad values, return + // with DIREC = -1.0. game.direc = -1.0; if (game.landed && !isprobe) { @@ -324,7 +325,7 @@ static void getcd(bool isprobe, int akey) prout(_("(Manual navigation assumed.)")); else prout(_("(Manual movement assumed.)")); - navmode = automatic; + navmode = manual; break; } } @@ -437,7 +438,7 @@ static void getcd(bool isprobe, int akey) -void impuls(void) +void impulse(void) /* move under impulse power */ { double power; @@ -510,7 +511,7 @@ void warp(bool timewarp) if (game.damage[DWARPEN] > 10.0) { chew(); skip(1); - prout(_("Engineer Scott- \"The impulse engines are damaged, Sir.\"")); + prout(_("Engineer Scott- \"The warp engines are damaged, Sir.\"")); return; } if (damaged(DWARPEN) && game.warpfac > 4.0) { @@ -564,7 +565,11 @@ void warp(bool timewarp) 100.0*game.optime/game.state.remtime); prout(_(" percent of our")); proutn(_(" remaining time. Are you sure this is wise?\" ")); - if (ja() == false) { game.ididit = false; game.optime=0; return;} + if (ja() == false) { + game.ididit = false; + game.optime=0; + return; + } } } /* Entry WARPX */ @@ -641,7 +646,7 @@ void warp(bool timewarp) -void setwrp(void) +void setwarp(void) /* change the warp factor */ { int key; @@ -754,8 +759,7 @@ void atover(bool igrab) crmshp(); skip(1); prout(_("safely out of quadrant.")); - if (!damaged(DRADIO)) - game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = true; + game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = true; /* Try to use warp engines */ if (damaged(DWARPEN)) { skip(1); @@ -788,7 +792,7 @@ void atover(bool igrab) } while /* Repeat if another snova */ (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova); - if (KLINGREM==0) + if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0) finish(FWON); /* Snova killed remaining enemy. */ } @@ -831,8 +835,8 @@ void timwrp() } } } - /* Likewise, if in the original time the Galileo was abandoned, but - was on ship earlier, it would have vanished -- lets restore it */ + // Likewise, if in the original time the Galileo was abandoned, but + // was on ship earlier, it would have vanished -- let's restore it. if (game.iscraft == offship && !gotit && game.damage[DSHUTTL] >= 0.0) { prout(_("Checkov- \"Security reports the Galileo has reappeared in the dock!\"")); game.iscraft = onship; @@ -985,7 +989,7 @@ void mayday(void) } else { ddist = FOREVER; - for_starbases(m) { + for (m = 1; m <= game.state.rembase; m++) { xdist = QUADSIZE * distance(game.state.baseq[m], game.quadrant); if (xdist < ddist) { ddist = xdist; @@ -1061,27 +1065,27 @@ void mayday(void) } /* -** Abandon Ship -** -** The ship is abandoned. If your current ship is the Faire -** Queene, or if your shuttlecraft is dead, you're out of -** luck. You need the shuttlecraft in order for the captain -** (that's you!!) to escape. -** -** Your crew can beam to an inhabited starsystem in the -** quadrant, if there is one and if the transporter is working. -** If there is no inhabited starsystem, or if the transporter -** is out, they are left to die in outer space. -** -** If there are no starbases left, you are captured by the -** Klingons, who torture you mercilessly. However, if there -** is at least one starbase, you are returned to the -** Federation in a prisoner of war exchange. Of course, this -** can't happen unless you have taken some prisoners. -** -*/ + * Abandon Ship + * + * The ship is abandoned. If your current ship is the Faire + * Queene, or if your shuttlecraft is dead, you're out of + * luck. You need the shuttlecraft in order for the captain + * (that's you!!) to escape. + * + * Your crew can beam to an inhabited starsystem in the + * quadrant, if there is one and if the transporter is working. + * If there is no inhabited starsystem, or if the transporter + * is out, they are left to die in outer space. + * + * If there are no starbases left, you are captured by the + * Klingons, who torture you mercilessly. However, if there + * is at least one starbase, you are returned to the + * Federation in a prisoner of war exchange. Of course, this + * can't happen unless you have taken some prisoners. + * + */ -void abandn(void) +void abandon(void) /* abandon ship */ { int nb, l; @@ -1134,8 +1138,8 @@ void abandn(void) prout(_("Remainder of ship's complement beam down")); prout(_("to nearest habitable planet.")); } else if (q->planet != NOPLANET && !damaged(DTRANSP)) { - prout(_("Remainder of ship's complement beam down")); - prout(_("to %s."), systnames[q->planet]); + prout(_("Remainder of ship's complement beam down to %s."), + systnames[q->planet]); } else { prout(_("Entire crew of %d left to die in outer space."), game.state.crew); @@ -1159,13 +1163,14 @@ void abandn(void) for (;;) { /* position next to base by trial and error */ game.quad[game.sector.x][game.sector.y] = IHDOT; - for_sectors(l) { + for (l = 1; l <= QUADSIZE; l++) { game.sector.x = 3.0*Rand() - 1.0 + game.base.x; game.sector.y = 3.0*Rand() - 1.0 + game.base.y; if (VALID_SECTOR(game.sector.x, game.sector.y) && game.quad[game.sector.x][game.sector.y] == IHDOT) break; } - if (l < QUADSIZE+1) break; /* found a spot */ + if (l < QUADSIZE+1) + break; /* found a spot */ game.sector.x=QUADSIZE/2; game.sector.y=QUADSIZE/2; newqad(true);