struct quadrant *q;
chew();
- if (game.condit==IHDOCKED) {
+ if (game.condition==docked) {
if (game.ship!=IHE) {
prout("You cannot abandon Ye Faerie Queene.");
return;
prout("Shuttle craft damaged.");
return;
}
- if (game.landed==1) {
+ if (game.landed) {
prout("You must be aboard the Enterprise.");
return;
}
- if (game.iscraft!=1) {
+ if (game.iscraft != onship) {
prout("Shuttle craft not currently available.");
return;
}
/* If at least one base left, give 'em the Faerie Queene */
skip(1);
- game.icrystl = 0; /* crystals are lost */
+ game.icrystl = false; /* crystals are lost */
game.nprobes = 0; /* No probes */
prout("You are captured by Klingons and released to");
prout("the Federation in a prisoner-of-war exchange.");
prout("Starfleet puts you in command of another ship,");
prout("the Faerie Queene, which is antiquated but,");
prout("still useable.");
- if (game.icrystl!=0) prout("The dilithium crystals have been moved.");
+ if (game.icrystl) prout("The dilithium crystals have been moved.");
game.imine = false;
- game.iscraft=0; /* Galileo disappears */
+ game.iscraft = offship; /* Galileo disappears */
/* Resupply ship */
- game.condit=IHDOCKED;
+ game.condition=docked;
for (l = 0; l < NDEVICES; l++)
game.damage[l] = 0.0;
game.damage[DSHUTTL] = -1;
game.state.crew = FULLCREW;
game.energy = game.inenrg = 5000.0;
game.shield = game.inshld = 2500.0;
- game.shldchg = 0;
+ game.shldchg = false;
game.shldup = false;
game.inlsr = 4.0;
game.lsupres = 4.0;
- game.quadrant = iran(GALSIZE);
- game.sector = iran(QUADSIZE);
+ game.quadrant = randplace(GALSIZE);
+ game.sector = randplace(QUADSIZE);
game.torps = game.intorps = 10;
game.nprobes = (int)(3.0*Rand() + 2.0); /* Give them 2-4 of these wonders */
game.warpfac = 5.0;
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 = game.imine = game.icraft = false;
- game.isatb = game.iscate = game.icrystl = game.state.nplankl = 0;
+ game.iscate = game.resting = game.imine = game.icrystl = game.icraft = false;
+ game.isatb = game.state.nplankl = 0;
game.state.starkl = game.state.basekl = 0;
- game.iscraft = 1;
- game.landed = -1;
- game.alive = 1;
+ game.iscraft = onship;
+ game.landed = false;
+ game.alive = true;
game.docfac = 0.25;
for_quadrants(i)
for_quadrants(j) {
quad->planet = NOPLANET;
quad->romulans = 0;
quad->klingons = 0;
- quad->starbase = 0;
- quad->supernova = 0;
+ quad->starbase = false;
+ quad->supernova = false;
quad->status = secure;
}
// Initialize times for extraneous events
for (i = 1; i <= game.inbase; i++) {
bool contflag;
do {
- do w = iran(GALSIZE);
+ do w = randplace(GALSIZE);
while (game.state.galaxy[w.x][w.y].starbase);
contflag = false;
for (j = i-1; j > 0; j--) {
} while (contflag);
game.state.baseq[i] = w;
- game.state.galaxy[w.x][w.y].starbase = 1;
- game.state.chart[w.x][w.y].starbase = 1;
+ game.state.galaxy[w.x][w.y].starbase = true;
+ game.state.chart[w.x][w.y].starbase = true;
}
// Position ordinary Klingon Battle Cruisers
krem = game.inkling;
int klump = (1.0 - r*r)*klumper;
if (klump > krem) klump = krem;
krem -= klump;
- do w = iran(GALSIZE);
+ do w = randplace(GALSIZE);
while (game.state.galaxy[w.x][w.y].supernova ||
game.state.galaxy[w.x][w.y].klingons + klump > 9);
game.state.galaxy[w.x][w.y].klingons += klump;
}
else
#endif /* ODEBUG */
- w = iran(GALSIZE);
+ w = randplace(GALSIZE);
}
while ((!game.state.galaxy[w.x][w.y].klingons && Rand() < 0.75)||
game.state.galaxy[w.x][w.y].supernova||
}
// Locate planets in galaxy
for (i = 0; i < game.inplan; i++) {
- do w = iran(GALSIZE);
+ do w = randplace(GALSIZE);
while (game.state.galaxy[w.x][w.y].planet != NOPLANET);
game.state.plnets[i].w = w;
if (i < NINHAB) {
}
// Locate Romulans
for (i = 1; i <= game.state.nromrem; i++) {
- w = iran(GALSIZE);
+ w = randplace(GALSIZE);
game.state.galaxy[w.x][w.y].romulans = 1;
}
// Locate the Super Commander
if (game.state.nscrem > 0) {
- do w = iran(GALSIZE);
+ do w = randplace(GALSIZE);
while (game.state.galaxy[w.x][w.y].supernova || game.state.galaxy[w.x][w.y].klingons > 8);
game.state.kscmdr = w;
game.state.galaxy[w.x][w.y].klingons++;
}
// Place thing (in tournament game, thingx == -1, don't want one!)
if (thing.x != -1) {
- thing = iran(GALSIZE);
+ thing = randplace(GALSIZE);
}
- else {
+ else
thing.x = thing.y = 0;
- }
-// idate = date;
skip(2);
- game.state.snap = 0;
+ game.state.snap = false;
if (game.skill == SKILL_NOVICE) {
prout("It is stardate %d. The Federation is being attacked by",
return false;
}
-coord dropin(int iquad)
+coord dropin(feature iquad)
/* drop a feature on a random dot in the current quadrant */
{
coord w;
- do w = iran(QUADSIZE);
+ do w = randplace(QUADSIZE);
while (game.quad[w.x][w.y] != IHDOT);
game.quad[w.x][w.y] = iquad;
return w;
void newcnd(void)
/* update our alert status */
{
- game.condit = IHGREEN;
- if (game.energy < 1000.0) game.condit = IHYELLOW;
+ game.condition = green;
+ if (game.energy < 1000.0) game.condition = yellow;
if (game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons || game.state.galaxy[game.quadrant.x][game.quadrant.y].romulans)
- game.condit = IHRED;
- if (!game.alive) game.condit=IHDEAD;
+ game.condition = red;
+ if (!game.alive) game.condition=dead;
}
coord newkling(int i)
game.justin = true;
game.base.x = game.base.y = 0;
game.klhere = 0;
- game.comhere = 0;
+ game.comhere = false;
game.plnet.x = game.plnet.y = 0;
game.ishere = false;
game.irhere = 0;
game.nenhere = 0;
game.neutz = false;
game.inorbit = false;
- game.landed = -1;
+ game.landed = false;
game.ientesc = false;
game.ithere = false;
iqhere = false;
iqengry = false;
- game.iseenit = 0;
+ game.iseenit = false;
if (game.iscate) {
// Attempt to escape Super-commander, so tbeam back!
- game.iscate = 0;
+ game.iscate = false;
game.ientesc = true;
}
// Clear quadrant
if (i <= game.state.remcom) {
game.quad[w.x][w.y] = IHC;
game.kpower[game.klhere] = 950.0+400.0*Rand()+50.0*game.skill;
- game.comhere = 1;
+ game.comhere = true;
}
// If we need a super-commander, promote a Klingon
if (same(game.quadrant, game.state.kscmdr)) {
game.quad[game.ks[1].x][game.ks[1].y] = IHS;
game.kpower[1] = 1175.0 + 400.0*Rand() + 125.0*game.skill;
- game.iscate = game.state.remkl>1;
+ game.iscate = (game.state.remkl > 1);
game.ishere = true;
}
}
else
game.plnet = dropin(IHW);
}
- // Check for game.condition
+ // Check for condition
newcnd();
// And finally the stars
for (i = 1; i <= q->stars; i++)
// Check for RNZ
if (game.irhere > 0 && game.klhere == 0 && (q->planet == NOPLANET || game.state.plnets[q->planet].inhabited == UNINHABITED)) {
- game.neutz = 1;
+ game.neutz = true;
if (!damaged(DRADIO)) {
skip(1);
prout("LT. Uhura- \"Captain, an urgent message.");
// Put in THING if needed
if (same(thing, game.quadrant)) {
w = dropin(IHQUEST);
- thing = iran(GALSIZE);
+ thing = randplace(GALSIZE);
game.nenhere++;
- iqhere=1;
+ iqhere = true;
game.ks[game.nenhere] = w;
game.kdist[game.nenhere] = game.kavgd[game.nenhere] =
distance(game.sector, w);
game.quad[game.tholian.x][game.tholian.y] = IHT;
game.ithere = true;
game.nenhere++;
- game.ks[game.nenhere].x = game.tholian.x;
- game.ks[game.nenhere].y = game.tholian.y;
+ game.ks[game.nenhere] = game.tholian;
game.kdist[game.nenhere] = game.kavgd[game.nenhere] =
distance(game.sector, game.tholian);
game.kpower[game.nenhere] = Rand()*400.0 +100.0 +25.0*game.skill;