Compare commits

...

2 commits
master ... 1.20

Author SHA1 Message Date
Eric S. Raymond
fdfd28c41e Ready to shp 1.20. 2024-09-23 18:48:11 -04:00
Eric S. Raymond
2d8ebd234b Eliminare a confusing dummy argument in a macro. 2024-09-23 14:22:25 -04:00
4 changed files with 29 additions and 27 deletions

View file

@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
// SPDX-License-Identifier: CC-BY-4.0
Repository head::
1.20: 2024-09-23::
Make oldstyle correctly suppress line editing.
1.19: 2024-06-27::

View file

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

View file

@ -66,6 +66,8 @@
* the cave starts to close. Only seems to be significant for the bird
* and readable objects, notably the clam/oyster - but the code around
* those tests is difficult to read.
*
* All tests of the prop member are done with either these macros or ==.
*/
#define OBJECT_IS_NOTFOUND(obj) (game.objects[obj].prop == STATE_NOTFOUND)
#define OBJECT_IS_FOUND(obj) (game.objects[obj].prop == STATE_FOUND)
@ -92,7 +94,7 @@
* LIQUID() = object number of liquid in bottle
* LIQLOC(LOC) = object number of liquid (if any) at LOC
* 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)
* GSTONE(OBJ) = true if OBJ is a gemstone
* FOREST(LOC) = true if LOC is part of the forest
@ -118,7 +120,7 @@
(CNDBIT((LOC), COND_FLUID) ? CNDBIT((LOC), COND_OILY) ? OIL : WATER \
: NO_OBJECT)
#define FORCED(LOC) CNDBIT(LOC, COND_FORCED)
#define DARK(DUMMY) \
#define IS_DARK_HERE() \
(!CNDBIT(game.loc, COND_LIT) && \
(game.objects[LAMP].prop == LAMP_DARK || !HERE(LAMP)))
#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;
}
if (!FORCED(game.loc) && DARK(game.loc)) {
if (!FORCED(game.loc) && IS_DARK_HERE()) {
msg = arbitrary_messages[PITCH_DARK];
}
@ -1047,7 +1047,7 @@ static void listobjects(void) {
* Similarly for chain; game.prop is initially CHAINING_BEAR (locked to
* bear). These hacks are because game.prop=0 is needed to
* get full score. */
if (!DARK(game.loc)) {
if (!IS_DARK_HERE()) {
++game.locs[game.loc].abbrev;
for (int i = game.locs[game.loc].atloc; i != 0;
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
* pitch darkness. */
if (!FORCED(game.loc) && DARK(game.loc) && game.wzdark &&
if (!FORCED(game.loc) && IS_DARK_HERE() && game.wzdark &&
PCT(PIT_KILL_PROB)) {
rspeak(PIT_FALL);
game.oldlc2 = game.loc;
@ -1283,7 +1283,7 @@ static bool do_command(void) {
}
/* 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.
* Possibly this should fire if the knife is here but