From 4ce4de190ee7088c94a87888298352b35d0ca4f3 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 5 Apr 2023 18:02:47 -0400 Subject: [PATCH] Magic number removal. --- advent.h | 1 + main.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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(); -- 2.31.1