for_starbases(i2) {
i = basetbl[i2]; /* bug in original had it not finding nearest*/
- ibq.x = game.state.baseq[i].x;
- ibq.y = game.state.baseq[i].y;
- if ((ibq.x == game.quadrant.x && ibq.y == game.quadrant.y) ||
- (ibq.x == game.battle.x && ibq.y == game.battle.y) ||
+ ibq = game.state.baseq[i];
+ if (same(ibq, game.quadrant) || same(ibq, game.battle) ||
game.state.galaxy[ibq.x][ibq.y].supernova ||
game.state.galaxy[ibq.x][ibq.y].klingons > 8)
continue;
}
}
if (ifindit==0) return; /* Nothing suitable -- wait until next time*/
- ibq.x = game.state.baseq[iwhichb].x;
- ibq.y = game.state.baseq[iwhichb].y;
+ ibq = game.state.baseq[iwhichb];
/* decide how to move toward base */
ideltax = ibq.x - game.state.kscmdr.x;
ideltay = ibq.y - game.state.kscmdr.y;
}
}
game.quad[game.tholian.x][game.tholian.y] = IHT;
- game.ks[game.nenhere].x=game.tholian.x;
- game.ks[game.nenhere].y=game.tholian.y;
+ game.ks[game.nenhere] = game.tholian;
/* check to see if all holes plugged */
for_sectors(i) {
crmena(0, ienm, 2, w);
if (ibumpd) proutn(_(" (original position)"));
skip(1);
- deadkl(w.x, w.y, ienm, game.sector.x, game.sector.y);
+ deadkl(w, ienm, game.sector.x, game.sector.y);
proutn("***");
crmshp();
prout(_(" heavily damaged."));
if (kp < h1) h1 = kp;
game.kpower[ll] -= (game.kpower[ll]<0 ? -h1 : h1);
if (game.kpower[ll] == 0) {
- deadkl(w.x, w.y, iquad, w.x, w.y);
+ deadkl(w, iquad, w.x, w.y);
return;
}
crmena(1, iquad, 2, w);
}
if (game.quad[jx][jy]==IHBLANK) {
prout(_(" buffeted into black hole."));
- deadkl(w.x, w.y, iquad, jx, jy);
+ deadkl(w, iquad, jx, jy);
return;
}
if (game.quad[jx][jy]!=IHDOT) {
proutn(_("Mr. Spock-"));
prouts(_(" \"Fascinating!\""));
skip(1);
- deadkl(w.x, w.y, iquad, w.x, w.y);
+ deadkl(w, iquad, w.x, w.y);
} else {
/*
* Stas Sergeev added the possibility that
game.quad[w.x][w.y] = IHDOT;
game.ithere = 0;
game.tholian.x = game.tholian.y = 0;
- deadkl(w.x, w.y, iquad, w.x, w.y);
+ deadkl(w, iquad, w.x, w.y);
return;
}
skip(1);
return;
}
-void deadkl(int ix, int iy, int type, int ixx, int iyy)
+void deadkl(coord w, int type, int ixx, int iyy)
{
/* Added ixx and iyy allow enemy to "move" before dying */
coord mv;
/* For each kind of enemy, finish message to player */
prout(_(" destroyed."));
- game.quad[ix][iy] = IHDOT;
+ game.quad[w.x][w.y] = IHDOT;
if (KLINGREM==0) return;
game.state.remtime = game.state.remres/(game.state.remkl + 4*game.state.remcom);
if (is_scheduled(FCDBAS) && game.battle.x==game.quadrant.x && game.battle.y==game.quadrant.y && type==IHC)
unschedule(FCDBAS);
for_local_enemies(i)
- if (game.ks[i].x==ix && game.ks[i].y==iy) break;
+ if (same(game.ks[i], w)) break;
game.nenhere--;
if (i <= game.nenhere) {
for (j=i; j<=game.nenhere; j++) {
return;
}
-static int targetcheck(double x, double y, double *course)
+static bool targetcheck(double x, double y, double *course)
{
double deltx, delty;
- /* Return TRUE if target is invalid */
+ /* Return true if target is invalid */
if (!VALID_SECTOR(x, y)) {
huh();
- return 1;
+ return true;
}
deltx = 0.1*(y - game.sector.y);
delty = 0.1*(game.sector.x - x);
prout(_(" I recommend an immediate review of"));
prout(_(" the Captain's psychological profile.\""));
chew();
- return 1;
+ return true;
}
*course = 1.90985932*atan2(deltx, delty);
- return 0;
+ return false;
}
void photon(void)
crmena(0,ienm,2,w);
skip(1);
if (kpow == 0) {
- deadkl(w.x, w.y, ienm, w.x, w.y);
+ deadkl(w, ienm, w.x, w.y);
if (KLINGREM==0) finish(FWON);
if (game.alldone) return;
kk--; /* don't do the increment */
int ictbeam=0, ipage=0, istract=0, line, i=0, j, k, l, ixhold=0, iyhold=0;
double fintim = game.state.date + game.optime, datemin, xtime, repair, yank=0;
int radio_was_broken;
+ struct quadrant *pdest;
#ifdef DEBUG
if (game.idebug) prout("EVENTS");
/* Not perfect, but will have to do */
/* Handle case where base is in same quadrant as starship */
if (game.battle.x==game.quadrant.x && game.battle.y==game.quadrant.y) {
- game.state.chart[game.battle.x][game.battle.y].starbase = FALSE;
- game.quad[game.base.x][game.base.y]= IHDOT;
+ game.state.chart[game.battle.x][game.battle.y].starbase = false;
+ game.quad[game.base.x][game.base.y] = IHDOT;
game.base.x=game.base.y=0;
newcnd();
skip(1);
prout(_(" has been destroyed by"));
if (game.isatb==2) prout(_("the Klingon Super-Commander"));
else prout(_("a Klingon Commander"));
- game.state.chart[game.battle.x][game.battle.y].starbase = FALSE;
+ game.state.chart[game.battle.x][game.battle.y].starbase = false;
}
/* Remove Starbase from galaxy */
- game.state.galaxy[game.battle.x][game.battle.y].starbase = FALSE;
+ game.state.galaxy[game.battle.x][game.battle.y].starbase = false;
for_starbases(i)
if (game.state.baseq[i].x==game.battle.x && game.state.baseq[i].y==game.battle.y) {
game.state.baseq[i].x=game.state.baseq[game.state.rembase].x;
prout(".\"");
}
}
+ pdest = &game.state.galaxy[game.probec.x][game.probec.y];
/* Update star chart if Radio is working or have access to
radio. */
if (game.damage[DRADIO] == 0.0 || game.condit == IHDOCKED) {
- game.state.chart[game.probec.x][game.probec.y].klingons = game.state.galaxy[game.probec.x][game.probec.y].klingons;
- game.state.chart[game.probec.x][game.probec.y].starbase = game.state.galaxy[game.probec.x][game.probec.y].starbase;
- game.state.chart[game.probec.x][game.probec.y].stars = game.state.galaxy[game.probec.x][game.probec.y].stars;
- game.state.galaxy[game.probec.x][game.probec.y].charted = TRUE;
+ struct page *chp = &game.state.chart[game.probec.x][game.probec.y];
+
+ chp->klingons = pdest->klingons;
+ chp->starbase = pdest->starbase;
+ chp->stars = pdest->stars;
+ pdest->charted = true;
}
game.proben--; // One less to travel
- if (game.proben == 0 && game.isarmed &&
- game.state.galaxy[game.probec.x][game.probec.y].stars) {
+ if (game.proben == 0 && game.isarmed && pdest->stars) {
/* lets blow the sucker! */
snova(1,0);
unschedule(FDSPROB);
game.quad[scratch.x][scratch.y] = IHDOT;
break;
case IHB: /* Destroy base */
- game.state.galaxy[game.quadrant.x][game.quadrant.y].starbase = FALSE;
+ game.state.galaxy[game.quadrant.x][game.quadrant.y].starbase = false;
for_starbases(i)
if (game.state.baseq[i].x==game.quadrant.x && game.state.baseq[i].y==game.quadrant.y)
break;
kount++;
break;
case IHK: /* kill klingon */
- deadkl(scratch.x,scratch.y,iquad, scratch.x, scratch.y);
+ deadkl(scratch,iquad, scratch.x, scratch.y);
break;
case IHC: /* Damage/destroy big enemies */
case IHS:
if (game.ks[ll].x==scratch.x && game.ks[ll].y==scratch.y) break;
game.kpower[ll] -= 800.0; /* If firepower is lost, die */
if (game.kpower[ll] <= 0.0) {
- deadkl(scratch.x, scratch.y, iquad, scratch.x, scratch.y);
+ deadkl(scratch, iquad, scratch.x, scratch.y);
break;
}
newc.x = scratch.x + scratch.x - hits[mm][1];
proutn(_(", blasted into "));
crmena(0, IHBLANK, 2, newc);
skip(1);
- deadkl(scratch.x, scratch.y, iquad, newc.x, newc.y);
+ deadkl(scratch, iquad, newc.x, newc.y);
break;
}
if (iquad1 != IHDOT) {
if ((game.quadrant.x == nq.x && game.quadrant.y == nq.y) ||
game.damage[DRADIO] == 0 ||
game.condit == IHDOCKED)
- game.state.galaxy[nq.x][nq.y].supernova = TRUE;
+ game.state.galaxy[nq.x][nq.y].supernova = true;
/* If supernova destroys last klingons give special message */
if (KLINGREM==0 && (nq.x != game.quadrant.x || nq.y != game.quadrant.y)) {
skip(2);
int l=1;
while (l <= game.nenhere) {
if (game.kpower[l]*game.kdist[l] <= whammo)
- deadkl(game.ks[l].x,game.ks[l].x, game.quad[game.ks[l].x][game.ks[l].y], game.ks[l].x, game.ks[l].y);
+ deadkl(game.ks[l], game.quad[game.ks[l].x][game.ks[l].y], game.ks[l].x, game.ks[l].y);
l++;
}
}
}
}
-void commandhook(char *cmd, int before) {
+void commandhook(char *cmd, bool before) {
}
/*
void setpassword(void)
{
if (!(game.options & OPTION_CURSES)) {
- while (TRUE) {
+ for (;;) {
scan();
strcpy(game.passwd, citem);
chew();
#include "sstlinux.h"
#include "sst.h"
-static void getcd(int, int);
+static void getcd(bool, int);
void imove(void)
{
w.x = w.y = 0;
if (game.inorbit) {
prout("Helmsman Sulu- \"Leaving standard orbit.\"");
- game.inorbit = FALSE;
+ game.inorbit = false;
}
angle = ((15.0 - game.direc) * 0.5235988);
}
}
-static void getcd(int isprobe, int akey) {
+static void getcd(bool isprobe, int akey) {
/* 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
}
if (game.energy > 30.0) {
- getcd(FALSE, 0);
+ getcd(false, 0);
if (game.direc == -1.0) return;
power = 20.0 + 100.0*game.dist;
}
}
/* Read in course and distance */
- getcd(FALSE, 0);
+ getcd(false, 0);
if (game.direc == -1.0) return;
/* Make sure starship has enough energy for the trip */
skip(1);
prout("safely out of quadrant.");
if (game.damage[DRADIO] == 0.0)
- 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 (game.damage[DWARPEN]) {
skip(1);
if (ja()==0) return;
}
- game.isarmed = FALSE;
+ game.isarmed = false;
if (key == IHALPHA && strcmp(citem,"armed") == 0) {
- game.isarmed = TRUE;
+ game.isarmed = true;
key = scan();
}
else if (key == IHEOL) {
proutn("Arm NOVAMAX warhead? ");
game.isarmed = ja();
}
- getcd(TRUE, key);
+ getcd(true, key);
if (game.direc == -1.0) return;
game.nprobes--;
angle = ((15.0 - game.direc) * 0.5235988);
}
}
/* Since starbase not in quadrant, set up new quadrant */
- game.quadrant.x = game.state.baseq[line].x;
- game.quadrant.y = game.state.baseq[line].y;
+ game.quadrant = game.state.baseq[line];
newqad(1);
}
/* dematerialize starship */
prouts("Sulu- \"Captain! It's working!\"");
skip(2);
while (game.nenhere > 0)
- deadkl(game.ks[1].x,game.ks[1].y,game.quad[game.ks[1].x][game.ks[1].y],game.ks[1].x,game.ks[1].y);
+ deadkl(game.ks[1], game.quad[game.ks[1].x][game.ks[1].y],game.ks[1].x,game.ks[1].y);
prout("Ensign Chekov- \"Congratulations, Captain!\"");
if (KLINGREM == 0) finish(FWON);
if ((game.options & OPTION_PLAIN) == 0) {
proutn(" -1");
else {
if (!game.damage[DRADIO])
- game.state.galaxy[x][y].charted = TRUE;
+ game.state.galaxy[x][y].charted = true;
game.state.chart[x][y].klingons = game.state.galaxy[x][y].klingons;
game.state.chart[x][y].starbase = game.state.galaxy[x][y].starbase;
game.state.chart[x][y].stars = game.state.galaxy[x][y].stars;
void dreprt(void)
{
- int jdam = FALSE, i;
+ bool jdam = false;
+ int i;
chew();
for (i = 0; i < NDEVICES; i++) {
if (!jdam) {
prout("DEVICE -REPAIR TIMES-");
prout(" IN FLIGHT DOCKED");
- jdam = TRUE;
+ jdam = true;
}
prout(" %16s %8.2f %8.2f",
device[i],
/* the "sy" request is undocumented */
static char requests[][3] =
{"","da","co","po","ls","wa","en","to","sh","kl","sy", "ti"};
- int leftside=TRUE, rightside=TRUE, i, j, jj, req=0, nn=FALSE;
- int goodScan=TRUE;
+
+ int i, j, jj, req=0;
+ int goodScan=true, leftside=true, rightside=true, nn=false;
switch (l) {
case SCAN_FULL: // SRSCAN
if (game.damage[DSRSENS] != 0) {
/* Allow base's sensors if docked */
if (game.condit != IHDOCKED) {
prout(" S.R. SENSORS DAMAGED!");
- goodScan=FALSE;
+ goodScan=false;
}
else
prout(" [Using Base's sensors]");
game.state.chart[game.quadrant.x][game.quadrant.y].klingons = game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons;
game.state.chart[game.quadrant.x][game.quadrant.y].starbase = game.state.galaxy[game.quadrant.x][game.quadrant.y].starbase;
game.state.chart[game.quadrant.x][game.quadrant.y].stars = game.state.galaxy[game.quadrant.x][game.quadrant.y].stars;
- game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = TRUE;
+ game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = true;
}
scan();
- if (isit("chart")) nn = TRUE;
- if (isit("no")) rightside = FALSE;
+ if (isit("chart")) nn = true;
+ if (isit("no")) rightside = false;
chew();
prout(" 1 2 3 4 5 6 7 8 9 10");
break;
prout("UNRECOGNIZED REQUEST. Legal requests are:");
prout(" date, condition, position, lsupport, warpfactor,");
prout(" energy, torpedoes, shields, klingons, time, system, bases.");
- return FALSE;
+ return false;
}
// no break
case SCAN_STATUS: // STATUS
chew();
- leftside = FALSE;
+ leftside = false;
skip(1);
// no break
case SCAN_NO_LEFTSIDE: // REQUEST
- leftside=FALSE;
+ leftside=false;
break;
}
if (game.condit != IHDOCKED) newcnd();
void eta(void)
{
- int ix1, ix2, iy1, iy2, prompt=FALSE;
- int wfl;
+ int ix1, ix2, iy1, iy2;
+ bool wfl, prompt = false;
double ttime, twarp, tpower;
if (game.damage[DCOMPTR] != 0.0) {
prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR.");
return;
}
if (scan() != IHREAL) {
- prompt = TRUE;
+ prompt = true;
chew();
proutn("Destination quadrant and/or sector? ");
if (scan()!=IHREAL) {
}
game.dist = sqrt(square(iy1-game.quadrant.x+0.1*(iy2-game.sector.x))+
square(ix1-game.quadrant.y+0.1*(ix2-game.sector.y)));
- wfl = FALSE;
+ wfl = false;
if (prompt) prout("Answer \"no\" if you don't know the value:");
- while (TRUE) {
+ for (;;) {
chew();
proutn("Time or arrival date? ");
if (scan()==IHREAL) {
chew();
proutn("Warp factor? ");
if (scan()== IHREAL) {
- wfl = TRUE;
+ wfl = true;
twarp = aaitem;
if (twarp<1.0 || twarp > 10.0) {
huh();
}
prout("Captain, certainly you can give me one of these.");
}
- while (TRUE) {
+ for (;;) {
chew();
ttime = (10.0*game.dist)/square(twarp);
tpower = game.dist*twarp*twarp*twarp*(game.shldup+1);
if (!wfl) return;
proutn("New warp factor to try? ");
if (scan() == IHREAL) {
- wfl = TRUE;
+ wfl = true;
twarp = aaitem;
if (twarp<1.0 || twarp > 10.0) {
huh();
prout("The starbase there will be destroyed by then.");
proutn("New warp factor to try? ");
if (scan() == IHREAL) {
- wfl = TRUE;
+ wfl = true;
twarp = aaitem;
if (twarp<1.0 || twarp > 10.0) {
huh();
#endif /* __HISTORICAL__ */
}
-void freeze(int boss)
+void freeze(bool boss)
{
FILE *fp;
int key;
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.resting = game.casual = 0;
- game.isatb = game.iscate = game.imine = game.icrystl = game.icraft = game.state.nplankl = 0;
+ game.isatb = game.iscate = true;
+ game.imine = game.icrystl = game.icraft = game.state.nplankl = 0;
game.state.starkl = game.state.basekl = 0;
game.iscraft = 1;
game.landed = -1;
}
// Locate star bases in galaxy
for (i = 1; i <= game.inbase; i++) {
- int contflag;
+ bool contflag;
do {
do iran(GALSIZE, &ix, &iy);
while (game.state.galaxy[ix][iy].starbase);
- contflag = FALSE;
+ contflag = false;
for (j = i-1; j > 0; j--) {
/* Improved placement algorithm to spread out bases */
double distq = square(ix-game.state.baseq[j].x) + square(iy-game.state.baseq[j].y);
if (distq < 6.0*(BASEMAX+1-game.inbase) && Rand() < 0.75) {
- contflag = TRUE;
+ contflag = true;
#ifdef DEBUG
prout("DEBUG: Abandoning base #%d at %d-%d", i, ix, iy);
#endif
if (game.neutz) attack(0); // bad luck to start in a Romulan Neutral Zone
}
-int choose(int needprompt)
+bool choose(bool needprompt)
{
- while (TRUE) {
+ for(;;) {
game.tourn = 0;
game.thawed = 0;
game.skill = SKILL_NONE;
if (!game.alldone) game.thawed = 1; // No plaque if not finished
report();
waitfor();
- return TRUE;
+ return true;
}
if (isit("regular")) break;
proutn("What is \"");
if (game.inkling > 50) {
game.inbase = (game.state.rembase += 1);
}
- return FALSE;
+ return false;
}
void dropin(int iquad, coord *w)
void sortkl(void)
{
double t;
- int sw, j, k;
+ int j, k;
+ bool sw;
// The author liked bubble sort. So we will use it. :-(
if (game.nenhere-iqhere-game.ithere < 2) return;
do {
- sw = FALSE;
+ sw = false;
for (j = 1; j < game.nenhere; j++)
if (game.kdist[j] > game.kdist[j+1]) {
- sw = TRUE;
+ sw = true;
t = game.kdist[j];
game.kdist[j] = game.kdist[j+1];
game.kdist[j+1] = t;
/* Give help on commands */
int key;
key = scan();
- while (TRUE) {
+ for(;;) {
if (key == IHEOL) {
setwnd(prompt_window);
proutn("Help on what command? ");
static void makemoves(void)
{
- int i, v = 0, hitme;
+ int i, v = 0;
+ bool hitme;
clrscr();
setwnd(message_window);
- while (TRUE) { /* command loop */
+ for(;;) { /* command loop */
drawmaps(1);
- while (TRUE) { /* get a command */
- hitme = FALSE;
+ for(;;) { /* get a command */
+ hitme = false;
game.justin = 0;
game.optime = 0.0;
i = -1;
break;
listCommands();
}
- commandhook(commands[i].name, TRUE);
+ commandhook(commands[i].name, true);
switch (v) { /* command switch */
case SRSCAN: // srscan
srscan(SCAN_FULL);
break;
case PHASERS: // phasers
phasers();
- if (game.ididit) hitme = TRUE;
+ if (game.ididit) hitme = true;
break;
case TORPEDO: // photons
photon();
- if (game.ididit) hitme = TRUE;
+ if (game.ididit) hitme = true;
break;
case MOVE: // move
warp(1);
case SHIELDS: // shields
doshield(1);
if (game.ididit) {
- hitme=TRUE;
+ hitme=true;
game.shldchg = 0;
}
break;
break;
case REST: // rest
wait();
- if (game.ididit) hitme = TRUE;
+ if (game.ididit) hitme = true;
break;
case WARP: // warp
setwrp();
break;
case ORBIT: // orbit
orbit();
- if (game.ididit) hitme = TRUE;
+ if (game.ididit) hitme = true;
break;
case TRANSPORT: // transport "beam"
beam();
break;
case MINE: // mine
mine();
- if (game.ididit) hitme = TRUE;
+ if (game.ididit) hitme = true;
break;
case CRYSTALS: // crystals
usecrystals();
- if (game.ididit) hitme = TRUE;
+ if (game.ididit) hitme = true;
break;
case SHUTTLE: // shuttle
shuttle();
- if (game.ididit) hitme = TRUE;
+ if (game.ididit) hitme = true;
break;
case PLANETS: // Planet list
preport();
break;
case EMEXIT: // Emergency exit
clrscr(); // Hide screen
- freeze(TRUE); // forced save
+ freeze(true); // forced save
exit(1); // And quick exit
break;
case PROBE:
probe(); // Launch probe
- if (game.ididit) hitme = TRUE;
+ if (game.ididit) hitme = true;
break;
case ABANDON: // Abandon Ship
abandn();
dstrct();
break;
case SAVE: // Save Game
- freeze(FALSE);
+ freeze(false);
clrscr();
if (game.skill > SKILL_GOOD)
prout("WARNING--Saved games produce no plaques!");
break;
case DEATHRAY: // Try a desparation measure
deathray();
- if (game.ididit) hitme = TRUE;
+ if (game.ididit) hitme = true;
break;
case DEBUGCMD: // What do we want for debug???
#ifdef DEBUG
break;
case MAYDAY: // Call for help
mayday();
- if (game.ididit) hitme = TRUE;
+ if (game.ididit) hitme = true;
break;
case QUIT:
game.alldone = 1; // quit the game
helpme(); // get help
break;
}
- commandhook(commands[i].name, FALSE);
+ commandhook(commands[i].name, false);
for (;;) {
if (game.alldone) break; // Game has ended
#ifdef DEBUG
if (game.alldone) break;
if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova) { // went NOVA!
atover(0);
- hitme = TRUE;
+ hitme = true;
continue;
}
}
strcat(line, argv[i]);
strcat(line, " ");
}
- while (TRUE) { /* Play a game */
+ for(;;) { /* Play a game */
setwnd(fullscreen_window);
#ifdef DEBUG
prout("INITIAL OPTIONS: %0lx", game.options);
proutn("Do you want your score recorded?");
if (ja()) {
chew2();
- freeze(FALSE);
+ freeze(false);
}
}
proutn("Do you want to play again? ");
return IHALPHA;
}
-int ja(void)
+bool ja(void)
{
chew();
- while (TRUE) {
+ for(;;) {
scan();
chew();
- if (*citem == 'y') return TRUE;
- if (*citem == 'n') return FALSE;
+ if (*citem == 'y') return true;
+ if (*citem == 'n') return false;
proutn("Please answer with \"Y\" or \"N\": ");
}
}
}
proutn("Induce supernova here? ");
if (ja() != 0) {
- game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova = TRUE;
+ game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova = true;
atover(1);
}
}
#include <locale.h>
#include <libintl.h>
#include <curses.h>
+#include <stdbool.h>
#ifdef DATA_DIR
#define SSTDOC DATA_DIR"/"DOC_NAME
struct quadrant {
int stars;
planet *planet;
- int starbase;
+ bool starbase;
int klingons;
int romulans;
- int supernova;
- int charted;
+ bool supernova;
+ bool charted;
#ifdef EXPERIMENTAL
enum {secure, distressed, enslaved} status;
#endif /* EXPERIMENTAL */
} galaxy[GALSIZE+1][GALSIZE+1]; // The Galaxy (subscript 0 not used)
- struct {
+ struct page {
int stars;
int starbase;
int klingons;
coord battle; // base coordinates being attacked
coord plnet; // location of planet in quadrant
coord probec; // current probe quadrant
+ bool gamewon, // Finished!
+ ididit, // Action taken -- allows enemy to attack
+ alive, // We are alive (not killed)
+ justin, // just entered quadrant
+ alldone, // game is now finished
+ neutz, // Romulan Neutral Zone
+ isatb, // =1 if super commander is attacking base
+ isarmed, // probe is armed
+ thawed, // thawed game
+ iscate; // super commander is here
int inkling, // Initial number of klingons
inbase, // Initial number of bases
incom, // Initial number of commanders
casual, // causalties
nhelp, // calls for help
nkinks, // count of energy-barrier crossings
- ididit, // Action taken -- allows enemy to attack
- gamewon, // Finished!
- alive, // We are alive (not killed)
- justin, // just entered quadrant
- alldone, // game is now finished
shldchg, // shield is changing (affects efficiency)
inorbit, // orbiting
landed, // party on planet (1), on ship (-1)
inplan, // initial planets
nenhere, // number of enemies in quadrant
ishere, // super-commander in quandrant
- neutz, // Romulan Neutral Zone
irhere, // Romulans in quadrant
icraft, // Kirk in Galileo
ientesc, // attempted escape from supercommander
iscraft, // =1 if craft on ship, -1 if removed from game
- isatb, // =1 if super commander is attacking base
- iscate, // super commander is here
#ifdef DEBUG
idebug, // debug mode
#endif
iattak, // attack recursion elimination (was cracks[4])
icrystl, // dilithium crystals aboard
tourn, // tournament number
- thawed, // thawed game
ithere, // Tholian is here
iseenit, // seen base attack report
#ifdef EXPERIMENTAL
ndistr, //* count of distress calls */
#endif /* EXPERIMENTAL */
proben, // number of moves for probe
- isarmed, // probe is armed
nprobes; // number of probes available
double inresor, // initial resources
intime, // initial time
FHOLE} FINTYPE ;
enum loctype {neither, quadrant, sector};
-#ifndef TRUE
-#define TRUE (1)
-#define FALSE (0)
-#endif
-
#define IHR 'R'
#define IHK 'K'
#define IHC 'C'
/* Function prototypes */
void prelim(void);
void attack(int);
-int choose(int);
+bool choose(bool);
void setup(int);
void score(void);
void atover(int);
void finish(FINTYPE);
void dstrct(void);
void kaboom(void);
-void freeze(int);
+void freeze(bool);
int thaw(void);
void plaque(void);
int scan(void);
void proutn(char *, ...);
void stars(void);
void newqad(int);
-int ja(void);
+bool ja(void);
void cramen(int);
void crmshp(void);
char *cramlc(enum loctype, coord w);
void imove(void);
void ram(int, int, coord);
void crmena(int, int, int, coord w);
-void deadkl(int, int, int, int, int);
+void deadkl(coord, int, int, int);
void timwrp(void);
void movcom(void);
void torpedo(double, double, int, int, double *, int, int);
void cgetline(char *, int);
void waitfor(void);
void setpassword(void);
-void commandhook(char *, int);
+void commandhook(char *, bool);
void makechart(void);
void enqueue(char *);
char *systemname(planet *);