X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=sst.h;h=203a1690473f8b777861e89c5da8a7ca7ea3297c;hp=78596102d81c987fcc8c7018ac48fe7f5c2336e3;hb=bdcf85461c171a9263fb0ba0e0ec07661bd082f5;hpb=65b9a64fa507a2ec318ffaea1d8fdb070245c581 diff --git a/sst.h b/sst.h index 7859610..203a169 100644 --- a/sst.h +++ b/sst.h @@ -21,6 +21,15 @@ #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+1; i++) +#define for_sectors(i) for (i = 1; i < QUADSIZE+1; i++) + typedef struct { int x; /* Quadrant location of planet */ int y;