X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Fsst.h;h=89cb16f69c58261d0f9bdede84062b9f1af2dce4;hp=8616c416f1ad2777e1e28a788970bddd05e93912;hb=6332f1c7917206e23f408ebb505c483416b84e5b;hpb=cd1ac5957730cc1646ba29e2252c35d213b3557a diff --git a/src/sst.h b/src/sst.h index 8616c41..89cb16f 100644 --- a/src/sst.h +++ b/src/sst.h @@ -42,7 +42,9 @@ typedef struct {int x; int y;} coord; -#define same(c1, c2) (c1.x == c2.x && c1.y == c2.y) +#define square(i) ((i)*(i)) +#define same(c1, c2) ((c1.x == c2.x) && (c1.y == c2.y)) +#define distance(c1, c2) sqrt(square(c1.x - c2.x) + square(c1.y - c2.y)) typedef struct { coord w; @@ -210,11 +212,17 @@ struct game { alive, // we are alive (not killed) justin, // just entered quadrant shldup, // shields are up + ishere, // super-commander in quadrant + ientesc, // attempted escape from supercommander + ithere, // Tholian is here resting, // rest time + icraft, // Kirk in Galileo alldone, // game is now finished neutz, // Romulan Neutral Zone isarmed, // probe is armed inorbit, // orbiting a planet + imine, // mining + icrystl, // dilithium crystals aboard thawed; // thawed game int inkling, // initial number of klingons inbase, // initial number of bases @@ -237,20 +245,14 @@ struct game { shldchg, // shield is changing (affects efficiency) landed, // party on planet (1), on ship (-1) iplnet, // planet # in quadrant - imine, // mining inplan, // initial planets nenhere, // number of enemies in quadrant - ishere, // super-commander in quandrant irhere, // Romulans in quadrant - icraft, // Kirk in Galileo - ientesc, // attempted escape from supercommander iscraft, // =1 if craft on ship, -1 if removed from game 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 proben, // number of moves for probe nprobes; // number of probes available @@ -292,7 +294,7 @@ extern FILE *logfp, *replayfp; /* the Space Thingy's global state should *not* be saved! */ extern coord thing; -extern int iqhere, iqengry; +extern bool iqhere, iqengry; typedef enum {FWON, FDEPLETE, FLIFESUP, FNRG, FBATTLE, FNEG3, FNOVA, FSNOVAED, FABANDN, FDILITHIUM, @@ -352,10 +354,10 @@ void eta(void); void mayday(void); void abandn(void); void finish(FINTYPE); -void dstrct(void); +void selfdestruct(void); void kaboom(void); void freeze(bool); -int thaw(void); +bool thaw(void); void plaque(void); int scan(void); #define IHEOL (0) @@ -374,9 +376,8 @@ void crmshp(void); char *cramlc(enum loctype, coord w); double expran(double); double Rand(void); -void iran(int, int *, int *); -#define square(i) ((i)*(i)) -void dropin(int, coord*); +coord iran(int); +coord dropin(int); void newcnd(void); void sortkl(void); void imove(void); @@ -388,8 +389,8 @@ void movcom(void); void torpedo(double, double, int, int, double *, int, int); void huh(void); void pause_game(int); -void nova(int, int); -void snova(int, int); +void nova(coord); +void snova(bool, coord *); void scom(bool *); void hittem(double *); void prouts(char *, ...); @@ -410,8 +411,8 @@ void probe(void); void iostart(void); void setwnd(WINDOW *); void warble(void); -void boom(int, int); -void tracktorpedo(int, int, int, int, int, int); +void boom(coord); +void tracktorpedo(coord, int, int, int, int); void cgetline(char *, int); void waitfor(void); void setpassword(void); @@ -419,7 +420,7 @@ void commandhook(char *, bool); void makechart(void); void enqueue(char *); char *systemname(int); -void newkling(int, coord *); +coord newkling(int); /* mode arguments for srscan() */ #define SCAN_FULL 1