New debug-mode support.
[super-star-trek.git] / src / sst.h
index 182634d6c2da8b741ebaf6a22fc87bd529aecd7b..e5849937a5b0a1f6822bbb22b150963fae6efd6f 100644 (file)
--- a/src/sst.h
+++ b/src/sst.h
@@ -7,6 +7,7 @@
 #include <locale.h>
 #include <libintl.h>
 #include <curses.h>
+#include <stdbool.h>
 
 #ifdef DATA_DIR
 #define SSTDOC DATA_DIR"/"DOC_NAME
@@ -19,8 +20,6 @@
 #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)
@@ -77,16 +76,16 @@ typedef struct {
     struct quadrant {
        int stars;
        planet *planet;
-       int starbase;
+       bool starbase;
        int klingons;
        int romulans;
-       int supernova;
-       int charted;
+       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 {
+    struct page {
        int stars;
        int starbase;
        int klingons;
@@ -201,6 +200,14 @@ struct game {
     coord battle;              // base coordinates being attacked
     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)
+       justin,         // just entered quadrant
+       alldone,        // game is now finished
+       neutz,          // Romulan Neutral Zone
+       isarmed,        // probe is armed
+       thawed;         // thawed game
     int inkling,       // Initial number of klingons
        inbase,         // Initial number of bases
        incom,          // Initial number of commanders
@@ -218,11 +225,6 @@ struct game {
        casual,         // causalties
        nhelp,          // calls for help
        nkinks,         // count of energy-barrier crossings
-       ididit,         // Action taken -- allows enemy to attack
-       gamewon,        // Finished!
-       alive,          // We are alive (not killed)
-       justin,         // just entered quadrant
-       alldone,        // game is now finished
        shldchg,        // shield is changing (affects efficiency)
        inorbit,        // orbiting
        landed,         // party on planet (1), on ship (-1)
@@ -231,27 +233,21 @@ struct game {
        inplan,         // initial planets
        nenhere,        // number of enemies in quadrant
        ishere,         // super-commander in quandrant
-       neutz,          // Romulan Neutral Zone
        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
-#ifdef DEBUG
-       idebug,         // debug mode
-#endif
        iattak,         // attack recursion elimination (was cracks[4])
        icrystl,        // dilithium crystals aboard
        tourn,          // tournament number
-       thawed,         // thawed game
        ithere,         // Tholian is here 
        iseenit,        // seen base attack report
 #ifdef EXPERIMENTAL
        ndistr,         //* count of distress calls */ 
 #endif /* EXPERIMENTAL */
        proben,         // number of moves for probe
-       isarmed,        // probe is armed
        nprobes;        // number of probes available
     double inresor,    // initial resources
        intime,         // initial time
@@ -287,6 +283,10 @@ extern int iscore, iskill; // Common PLAQ
 extern double perdate;
 extern double aaitem;
 extern char citem[10];
+extern int seed;
+extern bool randready;
+extern bool idebug;
+extern FILE *logfp;
 
 /* the Space Thingy's global state should *not* be saved! */
 extern coord thing;
@@ -299,11 +299,6 @@ typedef enum {FWON, FDEPLETE, FLIFESUP, FNRG, FBATTLE,
                          FHOLE} FINTYPE ;
 enum loctype {neither, quadrant, sector};
 
-#ifndef TRUE
-#define TRUE (1)
-#define FALSE (0)
-#endif
-
 #define IHR 'R'
 #define IHK 'K'
 #define IHC 'C'
@@ -332,7 +327,7 @@ enum loctype {neither, quadrant, sector};
 /* Function prototypes */
 void prelim(void);
 void attack(int);
-int choose(int);
+bool choose(bool);
 void setup(int);
 void score(void);
 void atover(int);
@@ -357,7 +352,7 @@ void abandn(void);
 void finish(FINTYPE);
 void dstrct(void);
 void kaboom(void);
-void freeze(int);
+void freeze(bool);
 int thaw(void);
 void plaque(void);
 int scan(void);
@@ -371,7 +366,7 @@ void prout(char *, ...);
 void proutn(char *, ...);
 void stars(void);
 void newqad(int);
-int ja(void);
+bool ja(void);
 void cramen(int);
 void crmshp(void);
 char *cramlc(enum loctype, coord w);
@@ -385,7 +380,7 @@ void sortkl(void);
 void imove(void);
 void ram(int, int, coord);
 void crmena(int, int, int, coord w);
-void deadkl(int, int, int, int, int);
+void deadkl(coord, int, int, int);
 void timwrp(void);
 void movcom(void);
 void torpedo(double, double, int, int, double *, int, int);
@@ -418,7 +413,7 @@ void tracktorpedo(int ix, int iy, int l, int i, int n, int iquad);
 void cgetline(char *, int);
 void waitfor(void);
 void setpassword(void);
-void commandhook(char *, int);
+void commandhook(char *, bool);
 void makechart(void);
 void enqueue(char *);
 char *systemname(planet *);