#include <string.h>
#include <time.h>
-void dstrct()
+void selfdestruct(void)
+/* self-destruct maneuver */
{
/* Finish with a BANG! */
chew();
}
-void finish(FINTYPE ifin)
+void finish(FINTYPE ifin)
+/* end the game, with appropriate notfications */
{
bool igotit = false;
game.alldone = true;
}
void score(void)
+/* compute player's score */
{
double timused = game.state.date - game.indate;
int ithperd, iwon, klship;
prout(_("TOTAL SCORE %5d"), iscore);
}
-void plaque(void) {
+void plaque(void)
+/* emit winner's commemmorative plaque */
+{
FILE *fp=NULL;
time_t t;
char *timestring;
}
prout(_("SUCCEEDS!"));
if (game.imine) {
- game.imine = 0;
+ game.imine = false;
proutn(_("The crystals mined were "));
if (Rand() <= 0.25) {
prout(_("lost."));
static char *classes[] = {"M","N","O"};
-static int consumeTime(void)
+static bool consumeTime(void)
+/* abort a lengthy operation if an event interrupts it */
{
-/* I think most of this avoidance was caused by overlay scheme.
- Let's see what happens if all events can occur here */
-
-// double asave;
- game.ididit = 1;
-#if 0
- /* Don't worry about this */
- if (scheduled(FTBEAM) <= game.state.date+game.optime && game.state.remcom != 0 && game.condit != IHDOCKED) {
- /* We are about to be tractor beamed -- operation fails */
- return 1;
- }
-#endif
-// asave = scheduled(FSNOVA);
-// unschedule(FSNOVA); /* defer supernovas */
- events(); /* Used to avoid if FSCMOVE is scheduled within time */
-// schedule(FSNOVA, asave-game.state.time);
- /*fails if game over, quadrant super-novas or we've moved to new quadrant*/
- if (game.alldone || game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova || game.justin != 0) return 1;
- return 0;
+ game.ididit = true;
+ events();
+ if (game.alldone || game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova || game.justin)
+ return true;
+ return false;
}
void preport(void)
+/* report on (uninhabited) planets in the galaxy */
{
bool iknow = false;
int i;
prout(_(" Shuttle Craft Galileo on surface."));
}
}
- if (iknow==0) prout(_("No information available."));
+ if (!iknow) prout(_("No information available."));
}
-void orbit(void)
+void orbit(void)
+/* enter standard orbit */
{
skip(1);
chew();
game.ididit = true;
}
-void sensor(void)
+void sensor(void)
+/* examine planets in this quadrant */
{
skip(1);
chew();
}
void beam(void)
+/* use the transporter */
{
chew();
skip(1);
skip(1);
prout(_("Kirk- \"Energize.\""));
}
- game.ididit=1;
+ game.ididit = true;
skip(1);
prouts("WWHOOOIIIIIRRRRREEEE.E.E. . . . . . .");
skip(2);
if (game.landed==1 && game.state.plnets[game.iplnet].known==shuttle_down) {
prout(_("The shuttle craft Galileo is here!"));
}
- if (game.landed!=1 && game.imine==1) {
+ if (game.landed!=1 && game.imine) {
game.icrystl = 1;
game.cryprob = 0.05;
}
- game.imine = 0;
+ game.imine = false;
return;
}
void mine(void)
+/* strip-mine a world for dilithium */
{
skip(1);
chew();
prout(_("No dilithium crystals on this planet."));
return;
}
- if (game.imine == 1) {
+ if (game.imine) {
prout(_("You've already mined enough crystals for this trip."));
return;
}
if (consumeTime()) return;
prout(_("Mining operation complete."));
game.state.plnets[game.iplnet].crystals = MINED;
- game.imine = 1;
- game.ididit=1;
+ game.imine = game.ididit = true;
}
-void usecrystals(void)
+void usecrystals(void)
+/* use dilithium crystals */
{
- game.ididit=0;
+ game.ididit = false;
skip(1);
chew();
if (game.icrystl!=1) {
prout(_(" are going crazy, but I think it's"));
prout(_(" going to work!! Congratulations, Sir!\""));
game.cryprob *= 2.0;
- game.ididit=1;
+ game.ididit = true;
}
void shuttle(void)
+/* use shuttlecraft for planetary jaunt */
{
chew();
skip(1);
if (consumeTime()) return;
game.iscraft = 1;
game.icraft = 0;
- if (game.imine!=0) {
+ if (game.imine) {
game.icrystl = 1;
game.cryprob = 0.05;
}
- game.imine = 0;
+ game.imine = false;
prout(_("Trip complete."));
return;
}
}
}
-void deathray(void)
+void deathray(void)
+/* use the big zapper */
{
double dprob, r = Rand();
- game.ididit = 0;
+ game.ididit = false;
skip(1);
chew();
if (game.ship != IHE) {
if (ja() == false) return;
prout(_("Spock- \"Acknowledged.\""));
skip(1);
- game.ididit=1;
+ game.ididit = true;
prouts(_("WHOOEE ... WHOOEE ... WHOOEE ... WHOOEE"));
skip(1);
prout(_("Crew scrambles in emergency preparation."));
}
char *systemname(int pindx)
+/* return the name of a given solar system */
{
static char copy[BUFSIZ];
/* the below array should not be static, or it won't gettextize
#include <stdlib.h>
#include <string.h>
-void attakreport(bool curt)
+void attakreport(bool curt)
+/* report status of bases under attack */
{
if (!curt) {
if (is_scheduled(FCDBAS)) {
}
-void report(void)
+void report(void)
+/* report on general game status */
{
char *s1,*s2,*s3;
}
void lrscan(void)
+/* long-range sensor scan */
{
int x, y;
chew();
}
void dreprt(void)
+/* damage report */
{
bool jdam = false;
int i;
}
}
-void chart(bool title)
+void chart(bool title)
+/* display the star chart */
{
int i,j;
chew();
}
static void sectscan(int goodScan, int i, int j)
+/* light up an individual dot in a sector */
{
if (goodScan || (abs(i-game.sector.x)<= 1 && abs(j-game.sector.y) <= 1)){
if ((game.quad[i][j]==IHMATER0)||(game.quad[i][j]==IHMATER1)||(game.quad[i][j]==IHMATER2)||(game.quad[i][j]==IHE)||(game.quad[i][j]==IHF)){
proutn("- ");
}
-static void status(int req)
+static void status(int req)
+/* print status report lines */
{
char *cp = NULL;
int t, dam = 0;
}
}
-int srscan(int l)
+int srscan(int l)
+/* short-range scan */
{
/* the "sy" request is undocumented */
static char requests[][3] =
void eta(void)
+/* use computer to get estimated time of arrival for a warp jump */
{
int ix1, ix2, iy1, iy2;
bool wfl, prompt = false;
prout("the Faerie Queene, which is antiquated but,");
prout("still useable.");
if (game.icrystl!=0) prout("The dilithium crystals have been moved.");
- game.imine=0;
+ game.imine = false;
game.iscraft=0; /* Galileo disappears */
/* Resupply ship */
game.condit=IHDOCKED;
game.battle.x = game.battle.y = 0;
game.state.date = game.indate = 100.0*(int)(31.0*Rand()+20.0);
game.nkinks = game.nhelp = game.casual = game.abandoned = 0;
- game.resting = false;
- game.isatb = game.iscate = game.imine = game.icrystl = game.icraft = game.state.nplankl = 0;
+ game.resting = game.imine = false;
+ game.isatb = game.iscate = game.icrystl = game.icraft = game.state.nplankl = 0;
game.state.starkl = game.state.basekl = 0;
game.iscraft = 1;
game.landed = -1;
abandn();
break;
case DESTRUCT: // Self Destruct
- dstrct();
+ selfdestruct();
break;
case SAVE: // Save Game
freeze(false);
neutz, // Romulan Neutral Zone
isarmed, // probe is armed
inorbit, // orbiting a planet
+ imine, // mining
thawed; // thawed game
int inkling, // initial number of klingons
inbase, // initial number of bases
shldchg, // shield is changing (affects efficiency)
landed, // party on planet (1), on ship (-1)
iplnet, // planet # in quadrant
- imine, // mining
inplan, // initial planets
nenhere, // number of enemies in quadrant
ishere, // super-commander in quandrant
void mayday(void);
void abandn(void);
void finish(FINTYPE);
-void dstrct(void);
+void selfdestruct(void);
void kaboom(void);
void freeze(bool);
int thaw(void);