X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Fplanets.c;h=e8ead07638782af4eeeb5613ae1d83ccad115144;hp=215a50c49e549388b46eb819704cb58ac1341d94;hb=aaf1baec91818fd274e6f291da6c5d813c5c1cc2;hpb=2e04509ec9be1e3ad2a1f8a7e84552d6896f89ab diff --git a/src/planets.c b/src/planets.c index 215a50c..e8ead07 100644 --- a/src/planets.c +++ b/src/planets.c @@ -12,7 +12,7 @@ static bool consumeTime(void) return false; } -void preport(void) +void survey(void) /* report on (uninhabited) planets in the galaxy */ { bool iknow = false; @@ -22,10 +22,11 @@ void preport(void) prout(_("Spock- \"Planet report follows, Captain.\"")); skip(1); for (i = 0; i < game.inplan; i++) { + if (game.state.planets[i].pclass == destroyed) + continue; if ((game.state.planets[i].known != unknown - && game.state.planets[i].inhabited == UNINHABITED) - || (idebug && game.state.planets[i].w.x !=0) - ) { + && game.state.planets[i].inhabited == UNINHABITED) + || idebug) { iknow = true; if (idebug && game.state.planets[i].known==unknown) proutn("(Unknown) "); @@ -77,17 +78,17 @@ void orbit(void) void sensor(void) /* examine planets in this quadrant */ { - skip(1); - chew(); if (damaged(DSRSENS)) { - prout(_("Short range sensors damaged.")); + if (game.options & OPTION_TTY) + prout(_("Short range sensors damaged.")); return; } - if (!game.plnet.x && (game.options & OPTION_TTY)) { - prout(_("Spock- \"No planet in this quadrant, Captain.\"")); + if (!is_valid(game.plnet)) { + if (game.options & OPTION_TTY) + prout(_("Spock- \"No planet in this quadrant, Captain.\"")); return; } - if ((game.plnet.x != 0)&& (game.state.planets[game.iplnet].known == unknown)) { + if (game.state.planets[game.iplnet].known == unknown) { prout(_("Spock- \"Sensor scan for %s-"), cramlc(quadrant, game.quadrant)); skip(1); prout(_(" Planet at %s is of class %s."), @@ -107,6 +108,7 @@ void sensor(void) void beam(void) /* use the transporter */ { + double nrgneed = 0; chew(); skip(1); if (damaged(DTRANSP)) { @@ -134,6 +136,35 @@ void beam(void) prout(_(" you may not go down.\"")); return; } + if (!game.landed && game.state.planets[game.iplnet].crystals==absent) { + prout(_("Spock- \"Captain, I fail to see the logic in")); + prout(_(" exploring a planet with no dilithium crystals.")); + proutn(_(" Are you sure this is wise?\" ")); + if (ja() == false) { + chew(); + return; + } + } + if (!(game.options & OPTION_PLAIN)) { + nrgneed = 50 * game.skill + game.height / 100.0; + if (nrgneed > game.energy) { + prout(_("Engineering to bridge--")); + prout(_(" Captain, we don't have enough energy for transportation.")); + return; + } + if (!game.landed && nrgneed * 2 > game.energy) { + prout(_("Engineering to bridge--")); + prout(_(" Captain, we have enough energy only to transport you down to")); + prout(_(" the planet, but there wouldn't be an energy for the trip back.")); + if (game.state.planets[game.iplnet].known == shuttle_down) + prout(_(" Although the Galileo shuttle craft may still be on a surface.")); + proutn(_(" Are you sure this is wise?\" ")); + if (ja() == false) { + chew(); + return; + } + } + } if (game.landed) { /* Coming from planet */ if (game.state.planets[game.iplnet].known==shuttle_down) { @@ -153,15 +184,6 @@ void beam(void) } else { /* Going to planet */ - if (game.state.planets[game.iplnet].crystals==absent) { - prout(_("Spock- \"Captain, I fail to see the logic in")); - prout(_(" exploring a planet with no dilithium crystals.")); - proutn(_(" Are you sure this is wise?\" ")); - if (ja() == false) { - chew(); - return; - } - } prout(_("Scotty- \"Transporter room ready, Sir.\"")); skip(1); prout(_("Kirk and landing party prepare to beam down to planet surface.")); @@ -180,9 +202,10 @@ void beam(void) return; } prouts(". . . . . . .E.E.EEEERRRRRIIIIIOOOHWW"); + game.landed = !game.landed; + game.energy -= nrgneed; skip(2); prout(_("Transport complete.")); - game.landed = !game.landed; if (game.landed && game.state.planets[game.iplnet].known==shuttle_down) { prout(_("The shuttle craft Galileo is here!")); } @@ -363,7 +386,8 @@ void shuttle(void) prout(_("You and your mining party board the")); prout(_("shuttle craft for the trip back to the Enterprise.")); skip(1); - prout(_("The short hop begins . . .")); + prouts(_("The short hop begins . . .")); + skip(1); game.state.planets[game.iplnet].known=known; game.icraft = true; skip(1); @@ -449,7 +473,7 @@ void deathray(void) while (game.nenhere > 0) deadkl(game.ks[1], game.quad[game.ks[1].x][game.ks[1].y],game.ks[1]); prout(_("Ensign Chekov- \"Congratulations, Captain!\"")); - if (KLINGREM == 0) + if ((game.state.remkl + game.state.remcom + game.state.nscrem) == 0) finish(FWON); if ((game.options & OPTION_PLAIN) == 0) { prout(_("Spock- \"Captain, I believe the `Experimental Death Ray'")); @@ -499,8 +523,8 @@ void deathray(void) proutn(_("Spock- \"I believe the word is")); prouts(_(" *ASTONISHING*")); prout(_(" Mr. Sulu.")); - for_sectors(i) - for_sectors(j) + for (i = 1; i <= QUADSIZE; i++) + for (j = 1; j <= QUADSIZE; j++) if (game.quad[i][j] == IHDOT) game.quad[i][j] = IHQUEST; prout(_(" Captain, our quadrant is now infested with"));