X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=sst.h;h=d9ed121d3de13dbcce6d335adf5d453df933f12a;hb=797f0f77ccdfd001fff39396ceae760478c2b920;hp=9a67c1d063ac1dd44cafcb6a6d15c34ff7edc51c;hpb=e536fe754b3a9be00dcaee8f6ec50ea2d8c7a184;p=super-star-trek.git diff --git a/sst.h b/sst.h index 9a67c1d..d9ed121 100644 --- a/sst.h +++ b/sst.h @@ -21,6 +21,18 @@ #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