}
static bool cancelrest(void)
+/* rest period is interrupted by event */
{
if (game.resting) {
skip(1);
proutn(_("Mr. Spock- \"Captain, shall we cancel the rest period?\""));
- if (ja()) {
+ if (ja() == true) {
game.resting = false;
game.optime = 0.0;
return true;
}
void events(void)
+/* run through the event queue looking for things to do */
{
int istract=0, evcode, i=0, j, k, l;
double fintim = game.state.date + game.optime, datemin, xtime, repair, yank=0;
finish(FDEPLETE);
return;
}
+ /* Any crew left alive? */
+ if (game.state.crew <=0) {
+ finish(FCREW);
+ return;
+ }
/* Is life support adequate? */
if (damaged(DLIFSUP) && game.condit != IHDOCKED) {
if (game.lsupres < xtime && game.damage[DLIFSUP] > game.lsupres) {
prout(_(" surveillance reports are coming in."));
skip(1);
if (game.iseenit==0) {
- attakreport(0);
+ attakreport(false);
game.iseenit = 1;
}
rechart();
crmshp();
prout(_(" caught in long range tractor beam--"));
/* If Kirk & Co. screwing around on planet, handle */
- atover(1); /* atover(1) is Grab */
+ atover(true); /* atover(true) is Grab */
if (game.alldone) return;
if (game.icraft == 1) { /* Caught in Galileo? */
finish(FSTRACTOR);
}
else prout(_("(Shields not currently useable.)"));
}
- newqad(0);
+ newqad(false);
/* Adjust finish time to time of tractor beaming */
fintim = game.state.date+game.optime;
attack(0);
void wait(void)
+/* wait on events */
{
int key;
double temp, delay, origTime;
- game.ididit = 0;
+ game.ididit = false;
for (;;) {
key = scan();
if (key != IHEOL) break;
if (delay <= 0.0) return;
if (delay >= game.state.remtime || game.nenhere != 0) {
proutn(_("Are you sure? "));
- if (ja() == 0) return;
+ if (ja() == false) return;
}
/* Alternate resting periods (events) with attacks */
if (game.optime < delay) attack(0);
if (game.alldone) return;
events();
- game.ididit = 1;
+ game.ididit = true;
if (game.alldone) return;
delay -= temp;
/* Repair Deathray if long rest at starbase */
}
void nova(int ix, int iy)
+/* star goes nova */
{
static double course[] =
{0.0, 10.5, 12.0, 1.5, 9.0, 0.0, 3.0, 7.5, 6.0, 4.5};
/* handle initial nova */
game.quad[ix][iy] = IHDOT;
- crmena(1, IHSTAR, 2, nov);
+ crmena(false, IHSTAR, sector, nov);
prout(_(" novas."));
game.state.galaxy[game.quadrant.x][game.quadrant.y].stars--;
game.state.starkl++;
hits[top2][2]=scratch.y;
game.state.galaxy[game.quadrant.x][game.quadrant.y].stars -= 1;
game.state.starkl++;
- crmena(1, IHSTAR, 2, scratch);
+ crmena(true, IHSTAR, sector, scratch);
prout(_(" novas."));
game.quad[scratch.x][scratch.y] = IHDOT;
break;
case IHP: /* Destroy planet */
game.state.galaxy[game.quadrant.x][game.quadrant.y].planet = NOPLANET;
game.state.nplankl++;
- crmena(1, IHP, 2, scratch);
+ crmena(true, IHP, sector, scratch);
prout(_(" destroyed."));
DESTROY(&game.state.plnets[game.iplnet]);
game.iplnet = game.plnet.x = game.plnet.y = 0;
game.base.x = game.base.y = 0;
game.state.basekl++;
newcnd();
- crmena(1, IHB, 2, scratch);
+ crmena(true, IHB, sector, scratch);
prout(_(" destroyed."));
game.quad[scratch.x][scratch.y] = IHDOT;
break;
}
newc.x = scratch.x + scratch.x - hits[mm][1];
newc.y = scratch.y + scratch.y - hits[mm][2];
- crmena(1, iquad, 2, scratch);
+ crmena(true, iquad, sector, scratch);
proutn(_(" damaged"));
if (!VALID_SECTOR(newc.x, newc.y)) {
/* can't leave quadrant */
iquad1 = game.quad[newc.x][newc.y];
if (iquad1 == IHBLANK) {
proutn(_(", blasted into "));
- crmena(0, IHBLANK, 2, newc);
+ crmena(false, IHBLANK, sector, newc);
skip(1);
deadkl(scratch, iquad, newc.x, newc.y);
break;
void snova(int insx, int insy)
+/* star goes supernova */
{
int comdead, nsx, nsy, num=0, kldead, iscdead;
int nrmdead, npdead;
- int incipient=0;
+ bool incipient = false;
coord nq;
nq.x = nq.y = 0;
}
if (idebug) {
proutn("=== Super nova here?");
- if (ja()==1) {
+ if (ja() == true) {
nq.x = game.quadrant.x;
nq.y = game.quadrant.y;
}
}
else {
/* we are in the quadrant! */
- incipient = 1;
+ incipient = true;
num = Rand()* game.state.galaxy[nq.x][nq.y].stars + 1;
for_sectors(nsx) {
for_sectors(nsy) {
}
}
else {
- incipient = 1;
+ incipient = true;
}
if (incipient) {
game.state.nromrem -= nrmdead;
npdead = num - nrmdead*10;
if (npdead) {
- int l;
- for (l = 0; l < game.inplan; l++)
- if (same(game.state.plnets[l].w, nq)) {
- DESTROY(&game.state.plnets[l]);
+ int loop;
+ for (loop = 0; loop < game.inplan; loop++)
+ if (same(game.state.plnets[loop].w, nq)) {
+ DESTROY(&game.state.plnets[loop]);
}
}
/* Destroy any base in supernovaed quadrant */
if (game.state.rembase) {
- int maxloop = game.state.rembase, l;
- for (l = 1; l <= maxloop; l++)
- if (same(game.state.baseq[l], nq)) {
- game.state.baseq[l] = game.state.baseq[game.state.rembase];
+ int maxloop = game.state.rembase, loop;
+ for (loop = 1; loop <= maxloop; loop++)
+ if (same(game.state.baseq[loop], nq)) {
+ game.state.baseq[loop] = game.state.baseq[game.state.rembase];
game.state.baseq[game.state.rembase].x = game.state.baseq[game.state.rembase].y = 0;
game.state.rembase--;
break;
if (same(game.quadrant, nq) || !damaged(DRADIO) || game.condit == IHDOCKED)
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)) {
+ if (KLINGREM==0 && !same(nq, game.quadrant)) {
skip(2);
if (insx == 0) prout(_("Lucky you!"));
proutn(_("A supernova in %s has just destroyed the last Klingons."),