Compare commits

...

5 commits
1.20 ... master

Author SHA1 Message Date
Eric S. Raymond
7d848c89e1 Add spell-checking to the regression tests. 2025-05-25 11:06:46 -04:00
Eric S. Raymond
7bbf994fce Spellcheck the manual page a well. No errors. 2025-05-25 11:03:34 -04:00
Eric S. Raymond
3e989aec53 Spellcheck the YAML - yielded one trivial fix. 2025-05-25 10:57:34 -04:00
Eric S. Raymond
9df69fe034 Ready to ship 1.20. 2024-09-23 18:48:11 -04:00
Eric S. Raymond
a2bb39dc7e Eliminate a confusing dummy argument in a macro. 2024-09-23 14:22:25 -04:00
9 changed files with 50 additions and 33 deletions

View file

@ -23,3 +23,5 @@ You can also use pip to install PyYAML: `pip3 install PyYAML`.
5. Run `./advent` to play.
6. If you want to buld the documentation you will need asciidoctor.
7. Running the regression tests requires batchspell

View file

@ -72,9 +72,12 @@ cppcheck:
pylint:
@-pylint --score=n *.py */*.py
check: advent cheat pylint cppcheck
check: advent cheat pylint cppcheck spellcheck
cd tests; $(MAKE) --quiet
spellcheck:
@batchspell adventure.yaml advent.adoc
reflow:
@clang-format --style="{IndentWidth: 8, UseTab: ForIndentation}" -i $$(find . -name "*.[ch]")
@black --quiet *.py

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

@ -3,6 +3,9 @@
// SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
// SPDX-License-Identifier: CC-BY-4.0
// batchspell: add advent logfile savefile roleplaying Gillogly PDP Ctrl-D
// batchspell: add EOF autosave endianness wumpus zork nethack
== NAME ==
advent - Colossal Cave Adventure

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))

View file

@ -1,6 +1,10 @@
# SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
# SPDX-License-Identifier: BSD-2-Clause
#
# batchspell: add XYZZY Twopit Bedquilt ne se sw nw dwarves dwarvish gouts
# batchspell: add Crowther add axe pinin Har har meself Hmmm Adventuredom
# batchspell: add Tsk gameplay bugfixes
#
# This YAML file gets processed into a collection of data structures and
# variable initializers describing Colossal Cave. It replaces an ad-hoc
# text database shipped with Adventure versions up to 2.5. The format
@ -3432,7 +3436,7 @@ objects: !!omap
- 'There are a few recent issues of "Spelunker Today" magazine here.'
texts:
- |-
I'm afraid the magazine is written in dwarvish. But pencilled on one
I'm afraid the magazine is written in dwarvish. But penciled on one
cover you see, "Please leave the magazines at the construction site."
- DWARF:
words: ['dwarf', 'dwarv']
@ -3940,11 +3944,13 @@ obituaries:
Oh dear, you seem to have gotten yourself killed. I might be able to
help you out, but I've never really done this before. Do you want me
to try to reincarnate you?
# batchspell: add wr
yes_response: |-
All right. But don't blame me if something goes wr......
--- POOF!! ---
You are engulfed in a cloud of orange smoke. Coughing and gasping,
you emerge from the smoke and find....
# batchspell: remove wr
- query: |-
You clumsy oaf, you've done it again! I don't know how long I can
keep this up. Do you want me to try reincarnating you again?
@ -4226,7 +4232,7 @@ actions: !!omap
message: |-
There is a puff of orange smoke; within it, fiery runes spell out:
\tOpen Adventure %V - http://www.catb.org/esr/open-adventure/
Open Adventure %V - http://www.catb.org/esr/open-adventure/
words: ['versi']
noaction: true

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

View file

@ -16,8 +16,8 @@ of Peje Nilsson in restructuring some particularly grotty gotos is
gratefully acknowledged. Petr Voropaev contributed fuzz testing and
code cleanups. Aaron Traas did a lot of painstaking work to improve
test coverage, and factored out the last handful of gotos. Ryan
Sarson nudged us into fixing a longstannding minor bug in the
handling of incorrect magic-word sequebcesm,
Sarson nudged us into fixing a longstanding minor bug in the
handling of incorrect magic-word sequences,
== Nomenclature ==
@ -75,7 +75,8 @@ Bug fixes:
* A few minor typos have been corrected: absence of capitalization on
"Swiss" and "Persian", inconsistent spelling of "imbedded" vs. "embedded",
"eying" for "eyeing", "thresholds" for "threshholds".
"eying" for "eyeing", "thresholds" for "threshholds", "pencilled"
for "penciled".
* Under odd circumstances (dropping rug or vase outdoors) the game could
formerly say "floor" when it should say "ground" (or "dirt", or