return;
}
if (game.damage[DSHUTTL]<0) {
- prout("Shuttle craft now serving Big Mac's.");
+ prout("Shuttle craft now serving Big Macs.");
return;
}
if (game.damage[DSHUTTL]>0) {
prout("Remainder of ship's complement beam down");
prout("to nearest habitable planet.");
if (game.state.rembase==0) {
- /* Ops! no place to go... */
+ /* Oops! no place to go... */
finish(FABANDN);
return;
}
game.docfac = 0.25;
for_quadrants(i)
for_quadrants(j) {
- game.state.galaxy[i][j].charted = 0;
- game.state.galaxy[i][j].planets = 0;
- game.state.galaxy[i][j].romulans = 0;
- game.state.galaxy[i][j].klingons = 0;
- game.state.galaxy[i][j].starbase = 0;
- game.state.galaxy[i][j].supernova = 0;
+ struct quadrant *quad = &game.state.galaxy[i][j];
+ quad->charted = 0;
+ quad->planet = NULL;
+ quad->romulans = 0;
+ quad->klingons = 0;
+ quad->starbase = 0;
+ quad->supernova = 0;
+#ifdef EXPERIMENTAL
+ quad->status = secure;
+#endif /* EXPERIMENTAL */
}
// Initialize times for extraneous events
game.future[FSNOVA] = game.state.date + expran(0.5 * game.intime);
game.future[FSCMOVE] = game.state.nscrem ? game.state.date+0.2777 : FOREVER;
game.future[FSCDBAS] = FOREVER;
game.future[FDSPROB] = FOREVER;
+#ifdef EXPERIMENTAL
+ if (game.options & OPTION_WORLDS)
+ /* in BSD-Trek, this is a fixed one stardate in the future */
+ game.future[FDISTR] = game.state.date + 1.0 + Rand();
+ game.future[FENSLV] = FOREVER;
+ game.future[FREPRO] = FOREVER;
+#endif /* EXPERIMENTAL */
// Starchart is functional but we've never seen it
game.lastchart = FOREVER;
// Put stars in the galaxy
}
// Locate planets in galaxy
for (i = 0; i < game.inplan; i++) {
- do iran(GALSIZE, &ix, &iy); while (game.state.galaxy[ix][iy].planets);
- game.state.galaxy[ix][iy].planets = 1;
+ do iran(GALSIZE, &ix, &iy); while (game.state.galaxy[ix][iy].planet);
game.state.plnets[i].x = ix;
game.state.plnets[i].y = iy;
- game.state.plnets[i].pclass = Rand()*3.0; // Planet class M N or O
- game.state.plnets[i].crystals = 1.5*Rand(); // 1 in 3 chance of crystals
- game.state.plnets[i].known = unknown;
+ if (i < NINHAB) {
+ game.state.plnets[i].pclass = M; // All inhabited planets are class M
+ game.state.plnets[i].crystals = 0;
+ game.state.plnets[i].known = known;
+ game.state.plnets[i].inhabited = i;
+ } else {
+ game.state.plnets[i].pclass = Rand()*3.0; // Planet class M N or O
+ game.state.plnets[i].crystals = 1.5*Rand(); // 1 in 3 chance of crystals
+ game.state.plnets[i].known = unknown;
+ game.state.plnets[i].inhabited = UNINHABITED;
+ }
+ if ((game.options & OPTION_WORLDS) || i >= NINHAB)
+ game.state.galaxy[ix][iy].planet = game.state.plnets + i;
}
// Locate Romulans
for (i = 1; i <= game.state.nromrem; i++) {
// Choose game options -- added by ESR for SST2K
if (scan() != IHALPHA) {
chew();
- proutn("Choose your game options: ");
+ proutn("Choose your game style (or just press enter): ");
scan();
}
if (isit("plain")) {
// Approximates the UT FORTRAN version.
- game.options &=~ (OPTION_THOLIAN | OPTION_PLANETS | OPTION_THINGY | OPTION_PROBE | OPTION_RAMMING | OPTION_MVBADDY | OPTION_BLKHOLE | OPTION_BASE);
+ game.options &=~ (OPTION_THOLIAN | OPTION_PLANETS | OPTION_THINGY | OPTION_PROBE | OPTION_RAMMING | OPTION_MVBADDY | OPTION_BLKHOLE | OPTION_BASE | OPTION_WORLDS);
game.options |= OPTION_PLAIN;
}
else if (isit("almy")) {
// Approximates Tom Almy's version.
- game.options &=~ (OPTION_THINGY | OPTION_BLKHOLE | OPTION_BASE);
+ game.options &=~ (OPTION_THINGY | OPTION_BLKHOLE | OPTION_BASE | OPTION_WORLDS);
game.options |= OPTION_ALMY;
}
else if (isit("fancy"))
game.state.rembase = 2.0 + Rand()*(BASEMAX-2.0);
game.inbase = game.state.rembase;
if (game.options & OPTION_PLANETS)
- game.inplan = (PLNETMAX/2) + (PLNETMAX/2+1)*Rand();
+ game.inplan = NINHAB + (MAXUNINHAB/2) + (MAXUNINHAB/2+1)*Rand();
game.state.nromrem = game.inrom = (2.0+Rand())*game.skill;
game.state.nscrem = game.inscom = (game.skill > SKILL_FAIR ? 1 : 0);
game.state.remtime = 7.0 * game.length;
if (!game.alive) game.condit=IHDEAD;
}
+void newkling(int i, int *pix, int *piy)
+/* drop new Klingon into current quadrant */
+{
+ dropin(IHK, pix, piy);
+ game.kx[i] = *pix;
+ game.ky[i] = *piy;
+ game.kdist[i] = game.kavgd[i] = sqrt(square(game.sectx-*pix) + square(game.secty-*piy));
+ game.kpower[i] = Rand()*150.0 +300.0 +25.0*game.skill;
+}
void newqad(int shutup)
{
- int i, j, ix, iy, nplan;
+ int i, j, ix, iy;
+ struct quadrant *here;
game.iattak = 1;
game.justin = 1;
for_sectors(i)
for_sectors(j)
game.quad[i][j] = IHDOT;
+ here = &game.state.galaxy[game.quadx][game.quady];
// cope with supernova
- if (game.state.galaxy[game.quadx][game.quady].supernova)
+ if (here->supernova)
return;
- game.klhere = game.state.galaxy[game.quadx][game.quady].klingons;
- game.irhere = game.state.galaxy[game.quadx][game.quady].romulans;
- nplan = game.state.galaxy[game.quadx][game.quady].planets;
+ game.klhere = here->klingons;
+ game.irhere = here->romulans;
game.nenhere = game.klhere + game.irhere;
// Position Starship
game.quad[game.sectx][game.secty] = game.ship;
- if (game.state.galaxy[game.quadx][game.quady].klingons) {
+ if (here->klingons) {
// Position ordinary Klingons
- for (i = 1; i <= game.klhere; i++) {
- dropin(IHK, &ix, &iy);
- game.kx[i] = ix;
- game.ky[i] = iy;
- game.kdist[i] = game.kavgd[i] = sqrt(square(game.sectx-ix) + square(game.secty-iy));
- game.kpower[i] = Rand()*150.0 +300.0 +25.0*game.skill;
- }
+ for (i = 1; i <= game.klhere; i++)
+ newkling(i, &ix, &iy);
// If we need a commander, promote a Klingon
for_commanders(i)
if (game.state.cx[i]==game.quadx && game.state.cy[i]==game.quady) break;
game.kpower[i] = Rand()*400.0 + 450.0 + 50.0*game.skill;
}
// If quadrant needs a starbase, put it in
- if (game.state.galaxy[game.quadx][game.quady].starbase)
+ if (here->starbase)
dropin(IHB, &game.basex, &game.basey);
- if (nplan) {
- // If quadrant needs a planet, put it in
- for (i=0; i < game.inplan; i++)
- if (game.state.plnets[i].x == game.quadx && game.state.plnets[i].y == game.quady) break;
- if (i < game.inplan) {
- game.iplnet = i;
+ // If quadrant needs a planet, put it in
+ if (here->planet) {
+ game.iplnet = here->planet - game.state.plnets;
+ if (here->planet->inhabited == UNINHABITED)
dropin(IHP, &game.plnetx, &game.plnety);
- }
+ else
+ dropin(IHW, &game.plnetx, &game.plnety);
}
// Check for game.condition
newcnd();
// And finally the stars
- for (i = 1; i <= game.state.galaxy[game.quadx][game.quady].stars; i++)
+ for (i = 1; i <= here->stars; i++)
dropin(IHSTAR, &ix, &iy);
// Check for RNZ
- if (game.irhere > 0 && game.klhere == 0) {
+ if (game.irhere > 0 && game.klhere == 0 && (!here->planet || here->planet->inhabited == UNINHABITED)) {
game.neutz = 1;
if (game.damage[DRADIO] <= 0.0) {
skip(1);