Eliminate a confusing dummy argument in a macro.

This commit is contained in:
Eric S. Raymond 2024-09-23 14:17:52 -04:00
parent 5c90880f0a
commit a2bb39dc7e
3 changed files with 26 additions and 26 deletions

View file

@ -676,7 +676,7 @@ static phase_codes_t extinguish(verb_t verb, obj_t obj) {
break; break;
case LAMP: case LAMP:
state_change(LAMP, LAMP_DARK); state_change(LAMP, LAMP_DARK);
rspeak(DARK(game.loc) ? PITCH_DARK : NO_MESSAGE); rspeak(IS_DARK_HERE() ? PITCH_DARK : NO_MESSAGE);
break; break;
case DRAGON: case DRAGON:
case VOLCANO: case VOLCANO:
@ -1155,12 +1155,12 @@ static phase_codes_t read(command_t command)
} }
} }
if (command.obj > NOBJECTS || command.obj == NO_OBJECT || if (command.obj > NOBJECTS || command.obj == NO_OBJECT ||
DARK(game.loc)) { IS_DARK_HERE()) {
return GO_UNKNOWN; return GO_UNKNOWN;
} }
} }
if (DARK(game.loc)) { if (IS_DARK_HERE()) {
sspeak(NO_SEE, command.word[0].raw); sspeak(NO_SEE, command.word[0].raw);
} else if (command.obj == OYSTER) { } else if (command.obj == OYSTER) {
if (!TOTING(OYSTER) || !game.closed) { if (!TOTING(OYSTER) || !game.closed) {

View file

@ -92,7 +92,7 @@
* LIQUID() = object number of liquid in bottle * LIQUID() = object number of liquid in bottle
* LIQLOC(LOC) = object number of liquid (if any) at LOC * LIQLOC(LOC) = object number of liquid (if any) at LOC
* FORCED(LOC) = true if LOC moves without asking for input (COND=2) * FORCED(LOC) = true if LOC moves without asking for input (COND=2)
* DARK(LOC) = true if location "LOC" is dark * IS_DARK_HERE() = true if location "LOC" is dark
* PCT(N) = true N% of the time (N integer from 0 to 100) * PCT(N) = true N% of the time (N integer from 0 to 100)
* GSTONE(OBJ) = true if OBJ is a gemstone * GSTONE(OBJ) = true if OBJ is a gemstone
* FOREST(LOC) = true if LOC is part of the forest * FOREST(LOC) = true if LOC is part of the forest
@ -118,7 +118,7 @@
(CNDBIT((LOC), COND_FLUID) ? CNDBIT((LOC), COND_OILY) ? OIL : WATER \ (CNDBIT((LOC), COND_FLUID) ? CNDBIT((LOC), COND_OILY) ? OIL : WATER \
: NO_OBJECT) : NO_OBJECT)
#define FORCED(LOC) CNDBIT(LOC, COND_FORCED) #define FORCED(LOC) CNDBIT(LOC, COND_FORCED)
#define DARK(DUMMY) \ #define IS_DARK_HERE() \
(!CNDBIT(game.loc, COND_LIT) && \ (!CNDBIT(game.loc, COND_LIT) && \
(game.objects[LAMP].prop == LAMP_DARK || !HERE(LAMP))) (game.objects[LAMP].prop == LAMP_DARK || !HERE(LAMP)))
#define PCT(N) (randrange(100) < (N)) #define PCT(N) (randrange(100) < (N))

8
main.c
View file

@ -534,7 +534,7 @@ static void describe_location(void) {
msg = locations[game.loc].description.big; msg = locations[game.loc].description.big;
} }
if (!FORCED(game.loc) && DARK(game.loc)) { if (!FORCED(game.loc) && IS_DARK_HERE()) {
msg = arbitrary_messages[PITCH_DARK]; msg = arbitrary_messages[PITCH_DARK];
} }
@ -1047,7 +1047,7 @@ static void listobjects(void) {
* Similarly for chain; game.prop is initially CHAINING_BEAR (locked to * Similarly for chain; game.prop is initially CHAINING_BEAR (locked to
* bear). These hacks are because game.prop=0 is needed to * bear). These hacks are because game.prop=0 is needed to
* get full score. */ * get full score. */
if (!DARK(game.loc)) { if (!IS_DARK_HERE()) {
++game.locs[game.loc].abbrev; ++game.locs[game.loc].abbrev;
for (int i = game.locs[game.loc].atloc; i != 0; for (int i = game.locs[game.loc].atloc; i != 0;
i = game.link[i]) { i = game.link[i]) {
@ -1229,7 +1229,7 @@ static bool do_move(void) {
/* The easiest way to get killed is to fall into a pit in /* The easiest way to get killed is to fall into a pit in
* pitch darkness. */ * pitch darkness. */
if (!FORCED(game.loc) && DARK(game.loc) && game.wzdark && if (!FORCED(game.loc) && IS_DARK_HERE() && game.wzdark &&
PCT(PIT_KILL_PROB)) { PCT(PIT_KILL_PROB)) {
rspeak(PIT_FALL); rspeak(PIT_FALL);
game.oldlc2 = game.loc; game.oldlc2 = game.loc;
@ -1283,7 +1283,7 @@ static bool do_command(void) {
} }
/* Check to see if the room is dark. */ /* Check to see if the room is dark. */
game.wzdark = DARK(game.loc); game.wzdark = IS_DARK_HERE();
/* If the knife is not here it permanently disappears. /* If the knife is not here it permanently disappears.
* Possibly this should fire if the knife is here but * Possibly this should fire if the knife is here but