More origin-hiding.
[super-star-trek.git] / sst.h
diff --git a/sst.h b/sst.h
index 9a67c1d063ac1dd44cafcb6a6d15c34ff7edc51c..d9ed121d3de13dbcce6d335adf5d453df933f12a 100644 (file)
--- a/sst.h
+++ b/sst.h
 #define QUADSIZE (10)
 #define BASEMAX        (6)
 
+/*
+ * These macros hide the difference between 0-origin and 1-origin addressing.
+ * They're a step towards de-FORTRANizing the code.
+ */
+#define VALID_QUADRANT(x, y)   ((x)>=1 && (x)<=GALSIZE && (y)>=1 && (y)<=GALSIZE)
+#define VALID_SECTOR(x, y)     ((x)>=1 && (x)<=QUADSIZE && (y)>=1 && (y)<=QUADSIZE)
+#define for_quadrants(i)       for (i = 1; i <= GALSIZE; i++)
+#define for_sectors(i)         for (i = 1; i <= QUADSIZE; i++)
+#define for_commanders(i)      for (i = 1; i <= game.state.remcom; i++)
+#define for_local_enemies(i)   for (i = 1; i <= nenhere; i++)
+#define for_starbases(i)       for (i = 1; i <= game.state.rembase; i++)
+
 typedef struct {
     int x;     /* Quadrant location of planet */
     int y;
@@ -212,7 +224,8 @@ EXTERN struct {
        probex,
        probey,
        probeinx,
-       probeiny;
+       probeiny,
+       height;
 } game;
 
 #define inkling game.inkling           // Initial number of klingons