From 51494657fd3689a4202e3ed6db41f5bcded9e2c6 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 22 Jun 2017 17:49:06 -0400 Subject: [PATCH] Give the FORCED property a real cond bit. Delete some unused code. --- advent.h | 2 +- common.h | 3 ++- dungeon.c | 7 ------- init.c | 2 +- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/advent.h b/advent.h index f52ea8e..94fbd88 100644 --- a/advent.h +++ b/advent.h @@ -151,7 +151,7 @@ extern int restore(FILE *); #define LIQUID() (LIQ2(game.prop[BOTTLE]<0 ? -1-game.prop[BOTTLE] : game.prop[BOTTLE])) #define LIQLOC(LOC) (LIQ2((MOD(conditions[LOC]/2*2,8)-5)*MOD(conditions[LOC]/4,2)+1)) #define CNDBIT(L,N) (TSTBIT(conditions[L],N)) -#define FORCED(LOC) (conditions[LOC] == 2) +#define FORCED(LOC) CNDBIT(LOC, COND_FORCED) #define DARK(DUMMY) ((!TSTBIT(conditions[game.loc],COND_LIT)) && (game.prop[LAMP] == 0 || !HERE(LAMP))) #define PCT(N) (randrange(100) < (N)) #define GSTONE(OBJ) ((OBJ) == EMERALD || (OBJ) == RUBY || (OBJ) == AMBER || (OBJ) == SAPPH) diff --git a/common.h b/common.h index bdc8e0d..e98384b 100644 --- a/common.h +++ b/common.h @@ -16,7 +16,8 @@ extern const char ascii_to_advent[128]; #define COND_NOBACK 4 /* Cannot use "back" to move away */ #define COND_ABOVE 5 #define COND_DEEP 6 /* Deep - e.g where dwarves are active */ -#define COND_FOREST 7 /* in the forest */ +#define COND_FOREST 7 /* In the forest */ +#define COND_FORCED 8 /* Only one way in or out of here */ /* Bits past 10 indicate areas of interest to "hint" routines */ #define COND_HBASE 10 /* Base for location hint bits */ #define COND_HCAVE 11 /* Trying to get into cave */ diff --git a/dungeon.c b/dungeon.c index f34cf12..6ef3525 100644 --- a/dungeon.c +++ b/dungeon.c @@ -52,13 +52,6 @@ long PLAC[NOBJECTS + 1]; long FIXD[NOBJECTS + 1]; long ACTSPK[VRBSIZ + 1]; -static bool is_set(long var, long position) -{ - long mask = 1L << position; - bool result = (var & mask) == mask; - return (result); -} - static long GETTXT(long SKIP, long ONEWRD, long UPPER) { /* Take characters from an input line and pack them into 30-bit words. diff --git a/init.c b/init.c index 5ae974f..1ed9df6 100644 --- a/init.c +++ b/init.c @@ -185,7 +185,7 @@ void initialise(void) if (!(locations[i].description.big == 0 || KEY[i] == 0)) { int k = KEY[i]; if (MOD(labs(TRAVEL[k]), 1000) == 1) - conditions[i] = 2; + conditions[i] |= (1 << COND_FORCED); } game.atloc[i] = 0; } -- 2.31.1