From 6d571c18b8a243f6c2d6aae100deb0051675de69 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 25 Jun 2017 18:37:14 -0400 Subject: [PATCH] Magic-number elimination. --- main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 733027f..ad2fdb1 100644 --- a/main.c +++ b/main.c @@ -25,6 +25,8 @@ #include "linenoise/linenoise.h" #include "newdb.h" +#define DIM(a) (sizeof(a)/sizeof(a[0])) + struct game_t game; long LNLENG, LNPOSN; @@ -414,7 +416,7 @@ static bool dwarfmove(void) !INDEEP(game.newloc) || game.newloc == game.odloc[i] || (j > 1 && game.newloc == tk[j - 1]) || - j >= 20 || + j >= DIM(tk) - 1 || game.newloc == game.dloc[i] || FORCED(game.newloc) || (i == PIRATE && CNDBIT(game.newloc, COND_NOARRR)) || -- 2.31.1