#define min(x, y) ((x)<(y)?(x):(y))
#define max(x, y) ((x)>(y)?(x):(y))
-// #define DEBUG
-
#define PHASEFAC (2.0)
#define GALSIZE (8)
#define NINHAB (GALSIZE * GALSIZE / 2)
starkl, // destroyed stars
basekl, // destroyed bases
nromrem, // Romulans remaining
- nplankl; // destroyed planets
- planet plnets[PLNETMAX]; // Planet information
- double date, // stardate
- remres, // remaining resources
- remtime; // remaining time
+ nplankl, // destroyed uninhabited planets
+ nworldkl; // destroyed inhabited planets
+ planet plnets[PLNETMAX]; // Planet information
+ double date, // stardate
+ remres, // remaining resources
+ remtime; // remaining time
coord baseq[BASEMAX+1]; // Base quadrant coordinates
coord kcmdr[QUADSIZE+1]; // Commander quadrant coordinates
coord kscmdr; // Supercommander quadrant coordinates
struct quadrant {
int stars;
- planet *planet;
+ int planet;
+#define NOPLANET -1
bool starbase;
int klingons;
int romulans;
bool supernova;
bool charted;
-#ifdef EXPERIMENTAL
enum {secure, distressed, enslaved} status;
-#endif /* EXPERIMENTAL */
} galaxy[GALSIZE+1][GALSIZE+1]; // The Galaxy (subscript 0 not used)
struct page {
int stars;
} chart[GALSIZE+1][GALSIZE+1]; // the starchart (subscript 0 not used)
} snapshot; // Data that is snapshot
+#define MAXKLGAME 127
+#define MAXKLQUAD 9
+
#define NKILLK (game.inkling - game.state.remkl)
#define NKILLC (game.incom - game.state.remcom)
#define NKILLSC (game.inscom - game.state.nscrem)
#define FSCMOVE 6 // Supercommander moves (might attack base)
#define FSCDBAS 7 // Supercommander destroys base
#define FDSPROB 8 // Move deep space probe
-#ifndef EXPERIMENTAL
-#define NEVENTS (9)
-#else /* EXPERIMENTAL */
#define FDISTR 9 // Emit distress call from an inhabited world
#define FENSLV 10 // Inhabited word is enslaved */
#define FREPRO 11 // Klingons build a ship in an enslaved system
#define NEVENTS (12)
-#endif /* EXPERIMENTAL */
+
+typedef struct {
+ double date;
+ coord quadrant;
+} event;
/*
* abstract out the event handling -- underlying data structures will change
* when we implement stateful events
*/
-extern void unschedule(int);
+extern event *unschedule(int);
extern int is_scheduled(int);
-extern void schedule(int, double);
+extern event *schedule(int, double);
extern void postpone(int, double);
extern double scheduled(int);
-
-#ifdef EXPERIMENTAL
-#define MAXDISTR 5 /* maximum concurrent distress calls */
-#endif /* EXPERIMENTAL */
+#define findevent(evtype) &game.future[evtype]
#define SSTMAGIC "SST2.0\n"
double kdist[(QUADSIZE+1)*(QUADSIZE+1)]; // enemy distances
double kavgd[(QUADSIZE+1)*(QUADSIZE+1)]; // average distances
double damage[NDEVICES]; // damage encountered
- double future[NEVENTS]; // future events
+ event future[NEVENTS]; // future events
char passwd[10]; // Self Destruct password
coord ks[(QUADSIZE+1)*(QUADSIZE+1)]; // enemy sector locations
coord quadrant, sector; // where we are
coord plnet; // location of planet in quadrant
coord probec; // current probe quadrant
bool gamewon, // Finished!
- ididit, // Action taken -- allows enemy to attack
- alive, // We are alive (not killed)
+ ididit, // action taken -- allows enemy to attack
+ alive, // we are alive (not killed)
justin, // just entered quadrant
+ shldup, // shields are up
+ resting, // rest time
alldone, // game is now finished
neutz, // Romulan Neutral Zone
- isatb, // =1 if super commander is attacking base
isarmed, // probe is armed
- thawed, // thawed game
- iscate; // super commander is here
- int inkling, // Initial number of klingons
- inbase, // Initial number of bases
- incom, // Initial number of commanders
- inscom, // Initial number of commanders
- inrom, // Initial number of commanders
- instar, // Initial stars
- intorps, // Initial/Max torpedoes
- condit, // Condition (red/yellow/green/docked)
+ inorbit, // orbiting a planet
+ thawed; // thawed game
+ int inkling, // initial number of klingons
+ inbase, // initial number of bases
+ incom, // initial number of commanders
+ inscom, // initial number of commanders
+ inrom, // initial number of commanders
+ instar, // initial stars
+ intorps, // initial/Max torpedoes
+ condit, // condition (red/yellow/green/docked)
torps, // number of torpedoes
- ship, // Ship type -- 'E' is Enterprise
+ ship, // ship type -- 'E' is Enterprise
length, // length of game
skill, // skill level
klhere, // klingons here
nhelp, // calls for help
nkinks, // count of energy-barrier crossings
shldchg, // shield is changing (affects efficiency)
- inorbit, // orbiting
landed, // party on planet (1), on ship (-1)
iplnet, // planet # in quadrant
imine, // mining
icraft, // Kirk in Galileo
ientesc, // attempted escape from supercommander
iscraft, // =1 if craft on ship, -1 if removed from game
-#ifdef DEBUG
- idebug, // debug mode
-#endif
+ isatb, // =1 if super commander is attacking base
+ iscate, // super commander is here
iattak, // attack recursion elimination (was cracks[4])
icrystl, // dilithium crystals aboard
tourn, // tournament number
ithere, // Tholian is here
iseenit, // seen base attack report
-#ifdef EXPERIMENTAL
- ndistr, //* count of distress calls */
-#endif /* EXPERIMENTAL */
proben, // number of moves for probe
nprobes; // number of probes available
double inresor, // initial resources
indate, // initial date
energy, // energy level
shield, // shield level
- shldup, // shields are up
warpfac, // warp speed
wfacsq, // squared warp factor
lsupres, // life support reserves
direc, // movement direction
optime, // time taken by current operation
docfac, // repair factor when docking (constant?)
- resting, // rest time
damfac, // damage factor
lastchart, // time star chart was last updated
cryprob, // probability that crystal will work
extern double perdate;
extern double aaitem;
extern char citem[10];
+extern int seed;
+extern bool idebug;
+extern FILE *logfp, *replayfp;
/* the Space Thingy's global state should *not* be saved! */
extern coord thing;
void lrscan(void);
void phasers(void);
void photon(void);
-void warp(int);
+void warp(bool);
void doshield(int);
void dock(int);
void dreprt(void);
void commandhook(char *, bool);
void makechart(void);
void enqueue(char *);
-char *systemname(planet *);
+char *systemname(int);
void newkling(int, coord *);
/* mode arguments for srscan() */