X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Fsst.h;h=8651afd849224e987eff13a79403326a6b2a5c45;hp=e5849937a5b0a1f6822bbb22b150963fae6efd6f;hb=fbb4aa04129c7e9fbe17428c5e151d4afbdd039e;hpb=459d6afcbe13be588b29c8bd1fbffb39b13fdee1 diff --git a/src/sst.h b/src/sst.h index e584993..8651afd 100644 --- a/src/sst.h +++ b/src/sst.h @@ -58,6 +58,8 @@ typedef struct { typedef struct { int snap, // snapshot taken + crew, // crew complement +#define FULLCREW 428 /* BSD Trek was 387, that's wrong */ remkl, // remaining klingons remcom, // remaining commanders nscrem, // remaining super commanders @@ -65,25 +67,25 @@ typedef struct { 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; @@ -92,6 +94,9 @@ typedef struct { } 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) @@ -143,6 +148,8 @@ typedef struct { #define DDSP 14 // Added deep space probe #define NDEVICES (15) // Number of devices +#define damaged(dev) game.damage[dev] != 0.0 + #define FOREVER 1e30 /* Define future events */ @@ -156,28 +163,26 @@ typedef struct { #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" @@ -191,7 +196,7 @@ struct game { 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 @@ -201,23 +206,27 @@ struct game { 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 isarmed, // probe is armed + 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) + 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 + abandoned, // count of crew abandoned in space length, // length of game skill, // skill level klhere, // klingons here @@ -226,7 +235,6 @@ struct game { 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 @@ -244,9 +252,6 @@ struct game { 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 @@ -257,7 +262,6 @@ struct game { indate, // initial date energy, // energy level shield, // shield level - shldup, // shields are up warpfac, // warp speed wfacsq, // squared warp factor lsupres, // life support reserves @@ -265,7 +269,6 @@ struct game { 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 @@ -284,9 +287,8 @@ extern double perdate; extern double aaitem; extern char citem[10]; extern int seed; -extern bool randready; extern bool idebug; -extern FILE *logfp; +extern FILE *logfp, *replayfp; /* the Space Thingy's global state should *not* be saved! */ extern coord thing; @@ -296,7 +298,7 @@ typedef enum {FWON, FDEPLETE, FLIFESUP, FNRG, FBATTLE, FNEG3, FNOVA, FSNOVAED, FABANDN, FDILITHIUM, FMATERIALIZE, FPHASER, FLOST, FMINING, FDPLANET, FPNOVA, FSSC, FSTRACTOR, FDRAY, FTRIBBLE, - FHOLE} FINTYPE ; + FHOLE, FCREW} FINTYPE ; enum loctype {neither, quadrant, sector}; #define IHR 'R' @@ -335,9 +337,9 @@ int srscan(int); void lrscan(void); void phasers(void); void photon(void); -void warp(int); +void warp(bool); void doshield(int); -void dock(int); +void dock(bool); void dreprt(void); void chart(int); void rechart(void); @@ -388,7 +390,7 @@ void huh(void); void pause_game(int); void nova(int, int); void snova(int, int); -void scom(int *); +void scom(bool *); void hittem(double *); void prouts(char *, ...); int isit(char *); @@ -416,7 +418,7 @@ void setpassword(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() */