diff options
author | June McEnroe <june@causal.agency> | 2018-07-19 15:44:16 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-07-19 15:44:16 -0400 |
commit | 5d6de9e0f527db9658b05b877496c824faa96c55 (patch) | |
tree | 981ce3f4dd57f28762461e6172cd0c93d8338afe /torus.h | |
parent | Add server map generation (diff) | |
download | torus-5d6de9e0f527db9658b05b877496c824faa96c55.tar.gz torus-5d6de9e0f527db9658b05b877496c824faa96c55.zip |
Add ARRAY_LEN macro
Diffstat (limited to '')
-rw-r--r-- | torus.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/torus.h b/torus.h index c058a4d..b5a0235 100644 --- a/torus.h +++ b/torus.h @@ -24,6 +24,8 @@ #define PACKED __attribute__((packed)) #define ALIGNED(x) __attribute__((aligned(x))) +#define ARRAY_LEN(a) (sizeof(a) / sizeof((a)[0])) + #undef COLOR_BLACK #undef COLOR_RED #undef COLOR_GREEN @@ -86,7 +88,6 @@ static const struct { { TILE_COLS * 1 / 4, TILE_ROWS * 1 / 4 }, // SE { TILE_COLS * 3 / 4, TILE_ROWS * 1 / 4 }, // SW }; -static const size_t SPAWNS_LEN = sizeof(SPAWNS) / sizeof(SPAWNS[0]); enum { MAP_ROWS = 11, |