From: Eric S. Raymond Date: Sun, 25 Jun 2017 22:37:14 +0000 (-0400) Subject: Magic-number elimination. X-Git-Tag: 1.1~114 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=6d571c18b8a243f6c2d6aae100deb0051675de69;p=open-adventure.git Magic-number elimination. --- 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)) ||