From: Eric S. Raymond Date: Wed, 5 Apr 2023 22:02:47 +0000 (-0400) Subject: Magic number removal. X-Git-Tag: 1.16~39 X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=commitdiff_plain;h=4ce4de190ee7088c94a87888298352b35d0ca4f3 Magic number removal. --- diff --git a/advent.h b/advent.h index 805b7a7..3afeb8e 100644 --- a/advent.h +++ b/advent.h @@ -34,6 +34,7 @@ #define BATTERYLIFE 2500 // turn limit increment from batteries #define WORD_NOT_FOUND -1 // "Word not found" flag value for the vocab hash functions. #define WORD_EMPTY 0 // "Word empty" flag value for the vocab hash functions +#define PIT_KILL_PROB 35 // Percentage probability of dying from fall in pit. #define CARRIED -1 // Player is toting it #define READ_MODE "rb" // b is not needed for POSIX but harmless #define WRITE_MODE "wb" // b is not needed for POSIX but harmless diff --git a/main.c b/main.c index acbabb6..ef7d392 100644 --- a/main.c +++ b/main.c @@ -1069,7 +1069,7 @@ static bool do_move(void) /* The easiest way to get killed is to fall into a pit in * pitch darkness. */ - if (!FORCED(game.loc) && DARK(game.loc) && game.wzdark && PCT(35)) { // FIXME: magic number + if (!FORCED(game.loc) && DARK(game.loc) && game.wzdark && PCT(PIT_KILL_PROB)) { rspeak(PIT_FALL); game.oldlc2 = game.loc; croak();