X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Fplanets.c;h=e8ead07638782af4eeeb5613ae1d83ccad115144;hp=f91a7d6e84516abc4802af642b4f8dadde0921c2;hb=aaf1baec91818fd274e6f291da6c5d813c5c1cc2;hpb=e4ddd3649bf73ddd7a1e2bb32e7ce2e631293068 diff --git a/src/planets.c b/src/planets.c index f91a7d6..e8ead07 100644 --- a/src/planets.c +++ b/src/planets.c @@ -78,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."), @@ -108,6 +108,7 @@ void sensor(void) void beam(void) /* use the transporter */ { + double nrgneed = 0; chew(); skip(1); if (damaged(DTRANSP)) { @@ -135,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) { @@ -154,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.")); @@ -181,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!")); } @@ -364,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);