Shortest abbreviation: PL
</literallayout>
-<para>Mr. Spock presents you a list of the available information on planets
-in the galaxy. Since planets do not show up on long-range scans, the
-only way to obtain this information is with the <quote>SENSORS</quote> command.</para>
+<para>Mr. Spock presents you a list of the available information on
+planets in the galaxy which are potential dilithium sources. Since
+planets do not show up on long-range scans, the only way to obtain
+this information is with the <quote>SENSORS</quote> command.</para>
</sect1>
<sect1 id="freeze"><title>Freeze</title>
game.state.plnets[i].crystals == 1) {
/* destroy the planet */
DESTROY(&game.state.plnets[i]);
- game.state.galaxy[game.state.isx][game.state.isy].planets -= 1;
+ game.state.galaxy[game.state.isx][game.state.isy].planet = NULL;
if (game.damage[DRADIO] == 0.0 || game.condit == IHDOCKED) {
if (*ipage==0) pause_game(1);
*ipage = 1;
crmena(1, iquad, 2, ix, iy);
prout(" destroyed.");
game.state.nplankl++;
- game.state.galaxy[game.quadx][game.quady].planets--;
+ game.state.galaxy[game.quadx][game.quady].planet = NULL;
DESTROY(&game.state.plnets[game.iplnet]);
game.iplnet = 0;
game.plnetx = game.plnety = 0;
game.quad[ii][jj] = IHDOT;
break;
case IHP: /* Destroy planet */
- game.state.galaxy[game.quadx][game.quady].planets -= 1;
+ game.state.galaxy[game.quadx][game.quady].planet = NULL;
game.state.nplankl++;
crmena(1, IHP, 2, ii, jj);
prout(" destroyed.");
prout("Spock- \"Planet report follows, Captain.\"");
skip(1);
for (i = 0; i < game.inplan; i++) {
- if (game.state.plnets[i].known != unknown
+ if ((game.state.plnets[i].known != unknown
+ && game.state.plnets[i].crystals != 0)
#ifdef DEBUG
|| ( game.idebug && game.state.plnets[i].x !=0)
#endif
proutn(" class ");
proutn(classes[game.state.plnets[i].pclass]);
proutn(" ");
- if (game.state.plnets[i].crystals == 0) proutn("no ");
+ if (game.state.plnets[i].crystals <= 0) proutn("no ");
prout("dilithium crystals present.");
if (game.state.plnets[i].known==shuttle_down)
prout(" Shuttle Craft Galileo on surface.");
prout("Mining party not on planet.");
return;
}
- if (game.state.plnets[game.iplnet].crystals == 0) {
+ if (game.state.plnets[game.iplnet].crystals == MINED) {
+ prout("This planet has already been strip-mined for dilithium.");
+ return;
+ }
+ else if (game.state.plnets[game.iplnet].crystals == 0) {
prout("No dilithium crystals on this planet.");
return;
}
game.optime = (0.1+0.2*Rand())*game.state.plnets[game.iplnet].pclass;
if (consumeTime()) return;
prout("Mining operation complete.");
+ game.state.plnets[game.iplnet].crystals = MINED;
game.imine = 1;
game.ididit=1;
}
finish(FTRIBBLE);
return;
}
+
+char *systemname(planet *planet)
+{
+ static char *names[NINHAB] =
+ {
+ /*
+ * This started out life as the BSD Trek inhabited-planets list,
+ * but I used <http://www.memory-alpha.org> to weed out planets
+ * with no references in ST:TOS and to fill it out again to the
+ * required length from "The Worlds of The Federation" list,
+ * <http://memory-alpha.org/en/wiki/The_Worlds_of_the_Federation>.
+ * Some misspellings have been silently corrected. (To be
+ * fair, there was no Web when Eric Allman did his list.)
+ *
+ * Some planets marked Class G and P here will be displayed as class M
+ * because of the way planets are generated. This is a known bug.
+ */
+ "ERROR",
+ // Added Federation Worlds
+ "Deneva", /* TOS: "Operation -- Annihilate!" */
+ "Eminiar VII", /* TOS: "A Taste of Armageddon" */
+ "Hansen's Planet", /* TOS: "The Galileo Seven" */
+ "Taurus IV", /* TOS: "The Galileo Seven" (class G) */
+ "Aldebaran III", /* TOS: "The Deadly Years" */
+ "Vulcan (T'Khasi)", /* many episodes */
+ "Tellar Prime (Miracht)", /* TOS: "Journey to Babel" */
+ "Andoria (Fesoan)", /* several episodes */
+ "Antos IV (Doraphane)", /* TOS: "Whom Gods Destroy", "Who Mourns for Adonais?" */
+ "Catulla (Cendo-Prae)", /* TOS: "The Way to Eden" */
+ "Izar", /* TOS: "Whom Gods Destroy" */
+ "Tiburon", /* TOS: "The Way to Eden" */
+ "Merak II", /* TOS: "The Cloud Minders" */
+ "Argelius II (Nelphia)", /* TOS: "Wolf in the Fold" ("IV" in BSD) */
+ "Daran V", /* TOS: "For the World is Hollow and I Have Touched the Sky" */
+ "Medusa", /* TOS: "Is There in Truth No Beauty?" */
+ "Coridan (Desotriana)", /* TOS: "Journey to Babel" */
+ "Berengaria IV", /* TOS: "This Side of Paradise" */
+ "Capella IV (Kohath)", /* TOS: "Friday's Child" (Class G) */
+ "Gideon", /* TOS: "The Mark of Gideon" */
+ "Iotia", /* TOS: "A Piece of the Action" */
+ /* Worlds from BSD Trek */
+ //"Talos IV", /* TOS: "The Cage" (interdicted world) */
+ "Rigel II", /* TOS: "Shore Leave" ("III" in BSD) */
+ "Deneb II", /* TOS: "Wolf in the Fold" ("IV" in BSD) */
+ //"Canopus V", /* noncanonical */
+ //"Icarus I", /* noncanonical */
+ //"Prometheus II", /* noncanonical */
+ //"Omega VII", /* noncanonical */
+ //"Elysium I", /* noncanonical */
+ "Scalos IV", /* TOS: "Wink of an Eye" */
+ //"Procyon IV", /* noncanonical */
+ //"Arachnid I", /* noncanonical */
+ //"Argo VIII", /* noncanonical */
+ //"Triad III", /* noncanonical */
+ //"Echo IV", /* noncanonical */
+ //"Nimrod III", /* noncanonical */
+ //"Nemisis IV", /* noncanonical */
+ //"Centarurus I", /* noncanonical */
+ //"Kronos III", /* noncanonical */
+ //"Spectros V", /* noncanonical */
+ "Beta III", /* TOS: "The Return of the Archons" */
+ "Gamma Tranguli VI (Vaalel)", /* TOS: "The Apple" */
+ "Pyris VII", /* TOS: "Catspaw" ("III" in BSD) */
+ "Triacus", /* TOS: "And the Children Shall Lead", */
+ "Marcos XII", /* TOS: "And the Children Shall Lead", */
+ //"Kaland", /* noncanonical */
+ "Ardana", /* TOS: "The Cloud Minders" */
+ //"Stratos", /* noncanonical */
+ //"Eden", /* TOS: "The Way to Eden" (in Romulan space) */
+ //"Arrikis", /* noncanonical */
+ //"Epsilon Eridani IV", /* noncanonical */
+ "Exo III", /* TOS: "What Are Little Girls Made Of?" (Class P) */
+ };
+
+ return names[planet->inhabited];
+}
proutn("Klingons Left %d", KLINGREM);
break;
case 10:
+ if (game.options & OPTION_WORLDS) {
+ planet *here = game.state.galaxy[game.quadx][game.quady].planet;
+ if (here && here->inhabited != UNINHABITED)
+ proutn("Major system %s", systemname(here));
+ else
+ proutn("Sector is uninhabited");
+ }
+
+ break;
+ case 11:
attakreport(1);
break;
}
int srscan(int l)
{
+ /* the "sy" request is undocumented */
static char requests[][3] =
- {"","da","co","po","ls","wa","en","to","sh","kl","ti"};
+ {"","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;
switch (l) {
if (req > sizeof(requests)/sizeof(requests[0])) {
prout("UNRECOGNIZED REQUEST. Legal requests are:");
prout(" date, condition, position, lsupport, warpfactor,");
- prout(" energy, torpedoes, shields, klingons, time, bases.");
+ prout(" energy, torpedoes, shields, klingons, time, system, bases.");
return FALSE;
}
// no break
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].planet = NULL;
game.state.galaxy[i][j].romulans = 0;
game.state.galaxy[i][j].klingons = 0;
game.state.galaxy[i][j].starbase = 0;
}
// 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++) {
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;
void newqad(int shutup)
{
- int i, j, ix, iy, nplan;
+ int i, j, ix, iy;
+ planet *planhere;
game.iattak = 1;
game.justin = 1;
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.nenhere = game.klhere + game.irhere;
// Position Starship
if (game.state.galaxy[game.quadx][game.quady].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;
- dropin(IHP, &game.plnetx, &game.plnety);
- }
+ // If quadrant needs a planet, put it in
+ planhere = game.state.galaxy[game.quadx][game.quady].planet;
+ if (planhere) {
+ game.iplnet = planhere - game.state.plnets;
+ dropin(IHP, &game.plnetx, &game.plnety);
}
// Check for game.condition
newcnd();
dropin(IHSTAR, &ix, &iy);
// Check for RNZ
- if (game.irhere > 0 && game.klhere == 0) {
+ if (game.irhere > 0 && game.klhere == 0 && (!planhere || planhere->inhabited == UNINHABITED)) {
game.neutz = 1;
if (game.damage[DRADIO] <= 0.0) {
skip(1);
4. Added game option selection so you can play a close (but not bug-for-
bug identical) approximation of older versions.
+
+ 5. Half the quadrants now have inhabited planets, from which one
+ cannot mine dilithium (there will still be the same additional number
+ of dilithium-bearing planets). Right now this is just color, but
+ eventually we'll fold in BSD-Trek-like logic for Klingons to attack
+ and enslave inhabited worlds.
*/
/* the input queue */
// #define DEBUG
#define PHASEFAC (2.0)
-#define PLNETMAX (10)
#define GALSIZE (8)
+#define NINHAB (GALSIZE * GALSIZE / 2)
+#define MAXUNINHAB (10)
+#define PLNETMAX (NINHAB + MAXUNINHAB)
#define QUADSIZE (10)
#define BASEMAX (5)
int x; /* Quadrant location of planet */
int y;
enum {M=0, N=1, O=2} pclass;
+ int inhabited; /* if NZ, an index into a name array */
+#define UNINHABITED -1
int crystals; /* has crystals */
+#define MINED -1 /* used to have crystals, but they were mined out */
enum {unknown, known, shuttle_down} known;
} planet;
remtime; // remaining time
struct {
int stars;
- int planets;
+ planet *planet;
int starbase;
int klingons;
int romulans;
#define OPTION_MVBADDY 0x00000100 /* more enemies can move */
#define OPTION_BLKHOLE 0x00000200 /* black hole may timewarp you */
#define OPTION_BASE 0x00000400 /* bases have good shields */
+#define OPTION_WORLDS 0x00000800 /* logic for inhabited worlds */
#define OPTION_PLAIN 0x01000000 /* user chose plain game */
#define OPTION_ALMY 0x02000000 /* user chose Almy variant */
void commandhook(char *, int);
void makechart(void);
void enqueue(char *);
+char *systemname(planet *);
/* mode arguments for srscan() */
#define SCAN_FULL 1