game.damage[l] -= (game.damage[l]-repair > 0.0 ? repair : game.damage[l]);
/* If radio repaired, update star chart and attack reports */
if (radio_was_broken && game.damage[DRADIO] == 0.0) {
- stdamtim = 1e30;
+ stdamtim = FOREVER;
prout("Lt. Uhura- \"Captain, the sub-space radio is working and");
prout(" surveillance reports are coming in.");
skip(1);
case FTBEAM: /* Tractor beam */
if (line==FTBEAM) {
if (game.state.remcom == 0) {
- game.future[FTBEAM] = 1e30;
+ game.future[FTBEAM] = FOREVER;
break;
}
i = Rand()*game.state.remcom+1.0;
/* Adjust finish time to time of tractor beaming */
fintim = game.state.date+Time;
attack(0);
- if (game.state.remcom <= 0) game.future[FTBEAM] = 1e30;
+ if (game.state.remcom <= 0) game.future[FTBEAM] = FOREVER;
else game.future[FTBEAM] = game.state.date+Time+expran(1.5*intime/game.state.remcom);
break;
case FSNAP: /* Snapshot of the universe (for time warp) */
case FBATTAK: /* Commander attacks starbase */
if (game.state.remcom==0 || game.state.rembase==0) {
/* no can do */
- game.future[FBATTAK] = game.future[FCDBAS] = 1e30;
+ game.future[FBATTAK] = game.future[FCDBAS] = FOREVER;
break;
}
i = 0;
if (j>game.state.rembase) {
/* no match found -- try later */
game.future[FBATTAK] = game.state.date + expran(0.3*intime);
- game.future[FCDBAS] = 1e30;
+ game.future[FCDBAS] = FOREVER;
break;
}
/* commander + starbase combination found -- launch attack */
}
break;
case FSCDBAS: /* Supercommander destroys base */
- game.future[FSCDBAS] = 1e30;
+ game.future[FSCDBAS] = FOREVER;
isatb = 2;
if (!game.state.galaxy[game.state.isx][game.state.isy].starbase)
break; /* WAS RETURN! */
baty = game.state.isy;
case FCDBAS: /* Commander succeeds in destroying base */
if (line==FCDBAS) {
- game.future[FCDBAS] = 1e30;
+ game.future[FCDBAS] = FOREVER;
/* find the lucky pair */
for_commanders(i)
if (game.state.cx[i]==batx && game.state.cy[i]==baty)
proutn("is no longer transmitting");
prout(".\"");
}
- game.future[FDSPROB] = 1e30;
+ game.future[FDSPROB] = FOREVER;
break;
}
if (game.damage[DRADIO]==0.0 || condit == IHDOCKED) {
game.state.galaxy[probecx][probecy].stars) {
/* lets blow the sucker! */
snova(1,0);
- game.future[FDSPROB] = 1e30;
+ game.future[FDSPROB] = FOREVER;
if (game.state.galaxy[quadx][quady].supernova)
return;
}
/* did in the Supercommander! */
game.state.nscrem = game.state.isx = game.state.isy = isatb = iscate = 0;
iscdead = 1;
- game.future[FSCMOVE] = game.future[FSCDBAS] = 1e30;
+ game.future[FSCMOVE] = game.future[FSCDBAS] = FOREVER;
}
game.state.remkl -= kldead;
if (game.state.remcom) {
game.state.remcom--;
kldead--;
comdead++;
- if (game.state.remcom==0) game.future[FTBEAM] = 1e30;
+ if (game.state.remcom==0) game.future[FTBEAM] = FOREVER;
break;
}
}
shield = inshld;
torps = intorps;
lsupres = inlsr;
- if (stdamtim != 1e30 &&
- (game.future[FCDBAS] < 1e30 || isatb == 1) && iseenit == 0) {
+ if (stdamtim != FOREVER &&
+ (game.future[FCDBAS] < FOREVER || isatb == 1) && iseenit == 0) {
/* get attack report from base */
prout("Lt. Uhura- \"Captain, an important message from the starbase:\"");
attakreport(0);
be sooner */
if (game.state.nscrem) game.future[FSCMOVE] = 0.2777;
isatb = 0;
- game.future[FCDBAS] = game.future[FSCDBAS] = 1e30;
+ game.future[FCDBAS] = game.future[FSCDBAS] = FOREVER;
batx = baty = 0;
/* Make sure Galileo is consistant -- Snapshot may have been taken
prout("Engineer Scott- \"The probe launcher is damaged, Sir.\"");
return;
}
- if (game.future[FDSPROB] != 1e30) {
+ if (game.future[FDSPROB] != FOREVER) {
chew();
skip(1);
if (game.damage[DRADIO] != 0 && condit != IHDOCKED) {
ddist = sqrt(square(basex-sectx)+square(basey-secty));
}
else {
- ddist = 1e30;
+ ddist = FOREVER;
for_starbases(l) {
xdist=10.0*sqrt(square(game.state.baseqx[l]-quadx)+square(game.state.baseqy[l]-quady));
if (xdist < ddist) {
void attakreport(int curt)
{
if (!curt) {
- if (game.future[FCDBAS] < 1e30) {
+ if (game.future[FCDBAS] < FOREVER) {
prout("Starbase in %s is currently under Commander attack.",
cramlc(quadrant, batx, baty));
prout("It can hold out until Stardate %d.",
(int)game.future[FSCDBAS]);
}
} else {
- if (game.future[FCDBAS] < 1e30)
+ if (game.future[FCDBAS] < FOREVER)
proutn("Base in %i - %i attacked by C. Alive until %.1f", batx, baty, game.future[FCDBAS]);
if (isatb == 1)
proutn("Base in %i - %i attacked by S. Alive until %.1f", game.state.isx, game.state.isy, game.future[FSCDBAS]);
prout(".");
}
if ((game.damage[DRADIO] == 0.0 || condit == IHDOCKED)&&
- game.future[FDSPROB] != 1e30) {
+ game.future[FDSPROB] != FOREVER) {
if (isarmed)
proutn("An armed deep space probe is in");
else
int i,j;
char *cp;
chew();
- if (stdamtim != 1e30 && stdamtim != game.state.date && condit == IHDOCKED) {
+ if (stdamtim != FOREVER && stdamtim != game.state.date && condit == IHDOCKED) {
proutn("Spock- \"I revised the Star Chart from the starbase's records.\"\n\r");
}
if (nn == 0) proutn(" STAR CHART FOR THE KNOWN GALAXY\n\r");
- if (stdamtim != 1e30) {
+ if (stdamtim != FOREVER) {
if (condit == IHDOCKED) {
/* We are docked, so restore chart from base information */
rechart();
game.future[FTBEAM] = game.state.date + expran(1.5 * (intime / game.state.remcom));
game.future[FSNAP] = game.state.date + 1.0 + Rand(); // Force an early snapshot
game.future[FBATTAK] = game.state.date + expran(0.3*intime);
- game.future[FCDBAS] = 1e30;
- game.future[FSCMOVE] = game.state.nscrem ? game.state.date+0.2777 : 1e30;
- game.future[FSCDBAS] = 1e30;
- game.future[FDSPROB] = 1e30;
- // Starchart is functional
- stdamtim = 1e30;
+ game.future[FCDBAS] = FOREVER;
+ game.future[FSCMOVE] = game.state.nscrem ? game.state.date+0.2777 : FOREVER;
+ game.future[FSCDBAS] = FOREVER;
+ game.future[FDSPROB] = FOREVER;
+ // Starchart is functional but we've never seen it
+ stdamtim = FOREVER;
// Put stars in the galaxy
instar = 0;
for_quadrants(i)
for (i=0; i < NDEVICES; i++)
if (game.damage[i] > 0.0)
game.damage[i] = 0.0;
- stdamtim = 1e30;
+ stdamtim = FOREVER;
}
proutn("Toggle idebug? ");
if (ja() != 0) {
key = scan();
if (key == IHALPHA && isit("y")) {
game.damage[i] = 10.0;
- if (i == DRADIO) stdamtim = game.state.date;
+ if (i == DRADIO)
+ stdamtim = game.state.date;
}
}
}
int i;
for (i = 1; i < NEVENTS; i++) {
int key;
- if (game.future[i] == 1e30) continue;
+ if (game.future[i] == FOREVER) continue;
switch (i) {
case FSNOVA: proutn("Supernova "); break;
case FTBEAM: proutn("T Beam "); break;
#define DDSP 14 // Added deep space probe
#define NDEVICES (15) // Number of devices
+#define FOREVER 1e30
+
/* Define future events */
#define FSPY 0 // Spy event happens always (no future[] entry)
// can cause SC to tractor beam Enterprise