From ec031b0417d85418e85d65e4c7fa5de609b568e0 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 15 Jun 2017 17:34:06 -0400 Subject: [PATCH] Name another magic number. --- advent.h | 3 ++- main.c | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/advent.h b/advent.h index 6ddbbbe..1f2bd8c 100644 --- a/advent.h +++ b/advent.h @@ -12,7 +12,8 @@ #define MAXPARMS 25 #define INVLIMIT 7 #define INTRANSITIVE -1 /* illegal object number */ -#define SPECIALBASE 300 /* base umber of special rooms */ +#define SPECIALBASE 300 /* base number of special rooms */ +#define WARNTIME 30 /* late game starts at game.limit-this */ typedef long token_t; /* word token - someday this will be char[TOKLEN+1] */ typedef long vocab_t; /* index into a vocabulary array */ diff --git a/main.c b/main.c index 5b35f6f..fbd7de0 100644 --- a/main.c +++ b/main.c @@ -248,8 +248,8 @@ static void checkhints(FILE *cmdin) SETPRM(1,HINTS[hint][2],HINTS[hint][2]); RSPEAK(HINT_COST); game.hinted[hint]=YES(cmdin,WANT_HINT,HINTS[hint][4],OK_MAN); - if (game.hinted[hint] && game.limit > 30) - game.limit=game.limit+30*HINTS[hint][2]; + if (game.hinted[hint] && game.limit > WARNTIME) + game.limit += WARNTIME*HINTS[hint][2]; } } } @@ -831,7 +831,7 @@ static void lampcheck(void) * Second is for other cases of lamp dying. 12400 is when it * goes out. Even then, he can explore outside for a while * if desired. */ - if (game.limit<=30 && HERE(BATTER) && game.prop[BATTER]==0 && HERE(LAMP)) + if (game.limit <= WARNTIME && HERE(BATTER) && game.prop[BATTER]==0 && HERE(LAMP)) { RSPEAK(REPLACE_BATTERIES); game.prop[BATTER]=1; @@ -844,7 +844,7 @@ static void lampcheck(void) game.prop[LAMP]=0; if (HERE(LAMP)) RSPEAK(LAMP_OUT); - } else if (game.limit <= 30) { + } else if (game.limit <= WARNTIME) { if (!game.lmwarn && HERE(LAMP)) { game.lmwarn=true; int spk=GET_BATTERIES; -- 2.31.1