Various cleanups.

* Remove disused macro.
* GCC doesn't seem to mind if IGNORE() is left off.
* Enumify phase codes.
* Use EXIT_* macros in all exit() calls.
* How did this even work without extern?
* Give advent.h a much-needed makeover.
* Use the chomp indicator in YAML string blocks to avoid code ugliness.
This commit is contained in:
Jason S. Ninneman 2017-06-30 13:51:03 -07:00 committed by Eric S. Raymond
parent 31f27b672c
commit 8bc08773fa
7 changed files with 186 additions and 201 deletions

157
advent.h
View file

@ -18,9 +18,41 @@
#define PANICTIME 15 // time left after closing #define PANICTIME 15 // time left after closing
#define BATTERYLIFE 2500 // turn limit increment from batteries #define BATTERYLIFE 2500 // turn limit increment from batteries
#define WORD_NOT_FOUND -1 // "Word not found" flag value for the vocab hash functions. #define WORD_NOT_FOUND -1 // "Word not found" flag value for the vocab hash functions.
#define CARRIED -1 // Player is toting it
#define READ_MODE "rb" // b is not needed for POSIX but harmless
#define WRITE_MODE "wb" // b is not needed for POSIX but harmless
typedef long token_t; // word token - someday this will be char[TOKLEN+1] /*
typedef long vocab_t; // index into a vocabulary array */ * MOD(N,M) = Arithmetic modulus
* AT(OBJ) = true if on either side of two-placed object
* CNDBIT(L,N) = true if COND(L) has bit n set (bit 0 is units bit)
* DARK(LOC) = true if location "LOC" is dark
* FORCED(LOC) = true if LOC moves without asking for input (COND=2)
* FOREST(LOC) = true if LOC is part of the forest
* GSTONE(OBJ) = true if OBJ is a gemstone
* HERE(OBJ) = true if the OBJ is at "LOC" (or is being carried)
* LIQUID() = object number of liquid in bottle
* LIQLOC(LOC) = object number of liquid (if any) at LOC
* PCT(N) = true N% of the time (N integer from 0 to 100)
* TOTING(OBJ) = true if the OBJ is being carried */
#define DESTROY(N) move(N, LOC_NOWHERE)
#define MOD(N,M) ((N) % (M))
#define TOTING(OBJ) (game.place[OBJ] == CARRIED)
#define AT(OBJ) (game.place[OBJ] == game.loc || game.fixed[OBJ] == game.loc)
#define HERE(OBJ) (AT(OBJ) || TOTING(OBJ))
#define LIQ2(PBOTL) ((1-(PBOTL))*WATER+((PBOTL)/2)*(WATER+OIL))
#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) CNDBIT(LOC, COND_FORCED)
#define DARK(DUMMY) ((!tstbit(conditions[game.loc],COND_LIT)) && (game.prop[LAMP] == LAMP_DARK || !HERE(LAMP)))
#define PCT(N) (randrange(100) < (N))
#define GSTONE(OBJ) ((OBJ) == EMERALD || (OBJ) == RUBY || (OBJ) == AMBER || (OBJ) == SAPPH)
#define FOREST(LOC) CNDBIT(LOC, COND_FOREST)
#define SPECIAL(LOC) ((LOC) > SPECIALBASE)
#define OUTSID(LOC) (CNDBIT(LOC, COND_ABOVE) || FOREST(LOC))
#define INDEEP(LOC) ((LOC) >= LOC_MISTHALL && !OUTSID(LOC))
#define BUG(x) bug(x, #x)
enum bugtype { enum bugtype {
SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST, SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST,
@ -34,9 +66,34 @@ enum bugtype {
ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH, ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH,
}; };
/* Alas, declaring this static confuses the coverage analyzer */ enum speaktype {touch, look, hear, study, change};
void bug(enum bugtype, const char *) __attribute__((__noreturn__));
#define BUG(x) bug(x, #x) enum termination {endgame, quitgame, scoregame};
enum speechpart {unknown, intransitive, transitive};
/* Phase codes for action returns.
* These were at one time FORTRAN line numbers.
* The values don't matter, but perturb their order at your peril.
*/
enum phase_codes {
GO_TERMINATE,
GO_MOVE,
GO_TOP,
GO_CLEAROBJ,
GO_CHECKHINT,
GO_CHECKFOO,
GO_DIRECTION,
GO_LOOKUP,
GO_WORD2,
GO_SPECIALS,
GO_UNKNOWN,
GO_ACTION,
GO_DWARFWAKE,
};
typedef long token_t; // word token - someday this will be char[TOKLEN+1]
typedef long vocab_t; // index into a vocabulary array */
struct game_t { struct game_t {
unsigned long lcg_a, lcg_c, lcg_m, lcg_x; unsigned long lcg_a, lcg_c, lcg_m, lcg_x;
@ -91,16 +148,18 @@ struct game_t {
long prop[NOBJECTS + 1]; long prop[NOBJECTS + 1];
}; };
extern struct game_t game; struct command_t {
enum speechpart part;
vocab_t verb;
vocab_t obj;
token_t wd1, wd1x;
token_t wd2, wd2x;
};
extern struct game_t game;
extern FILE *logfp; extern FILE *logfp;
extern bool oldstyle, editline, prompt; extern bool oldstyle, editline, prompt;
enum speaktype {touch, look, hear, study, change};
/* b is not needed for POSIX but harmless */
#define READ_MODE "rb"
#define WRITE_MODE "wb"
extern char* xstrdup(const char* s); extern char* xstrdup(const char* s);
extern void* xmalloc(size_t size); extern void* xmalloc(size_t size);
extern void packed_to_token(long, char token[]); extern void packed_to_token(long, char token[]);
@ -133,9 +192,6 @@ extern long setbit(long);
extern bool tstbit(long, int); extern bool tstbit(long, int);
extern void make_zzword(char*); extern void make_zzword(char*);
extern void datime(long*, long*); extern void datime(long*, long*);
enum termination {endgame, quitgame, scoregame};
extern void set_seed(long); extern void set_seed(long);
extern unsigned long get_next_lcg_value(void); extern unsigned long get_next_lcg_value(void);
extern long randrange(long); extern long randrange(long);
@ -145,75 +201,10 @@ extern int savefile(FILE *, long);
extern int suspend(void); extern int suspend(void);
extern int resume(void); extern int resume(void);
extern int restore(FILE *); extern int restore(FILE *);
extern void initialise(void);
extern int action(struct command_t *command);
/* /* Alas, declaring this static confuses the coverage analyzer */
* MOD(N,M) = Arithmetic modulus void bug(enum bugtype, const char *) __attribute__((__noreturn__));
* AT(OBJ) = true if on either side of two-placed object
* CNDBIT(L,N) = true if COND(L) has bit n set (bit 0 is units bit)
* DARK(LOC) = true if location "LOC" is dark
* FORCED(LOC) = true if LOC moves without asking for input (COND=2)
* FOREST(LOC) = true if LOC is part of the forest
* GSTONE(OBJ) = true if OBJ is a gemstone
* HERE(OBJ) = true if the OBJ is at "LOC" (or is being carried)
* LIQUID() = object number of liquid in bottle
* LIQLOC(LOC) = object number of liquid (if any) at LOC
* PCT(N) = true N% of the time (N integer from 0 to 100)
* TOTING(OBJ) = true if the OBJ is being carried */
#define DESTROY(N) move(N, LOC_NOWHERE)
#define MOD(N,M) ((N) % (M))
#define TOTING(OBJ) (game.place[OBJ] == CARRIED)
#define AT(OBJ) (game.place[OBJ] == game.loc || game.fixed[OBJ] == game.loc)
#define HERE(OBJ) (AT(OBJ) || TOTING(OBJ))
#define LIQ2(PBOTL) ((1-(PBOTL))*WATER+((PBOTL)/2)*(WATER+OIL))
#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) CNDBIT(LOC, COND_FORCED)
#define DARK(DUMMY) ((!tstbit(conditions[game.loc],COND_LIT)) && (game.prop[LAMP] == LAMP_DARK || !HERE(LAMP)))
#define PCT(N) (randrange(100) < (N))
#define GSTONE(OBJ) ((OBJ) == EMERALD || (OBJ) == RUBY || (OBJ) == AMBER || (OBJ) == SAPPH)
#define FOREST(LOC) CNDBIT(LOC, COND_FOREST)
#define SPECIAL(LOC) ((LOC) > SPECIALBASE)
#define OUTSID(LOC) (CNDBIT(LOC, COND_ABOVE) || FOREST(LOC))
#define INDEEP(LOC) ((LOC) >= LOC_MISTHALL && !OUTSID(LOC))
enum speechpart {unknown, intransitive, transitive};
struct command_t {
enum speechpart part;
vocab_t verb;
vocab_t obj;
token_t wd1, wd1x;
token_t wd2, wd2x;
};
void initialise(void);
int action(struct command_t *command);
/* Phase codes for action returns.
* These were at one time FORTRAN line numbers.
* The values don't matter, but perturb their order at your peril.
*/
#define GO_TERMINATE 2
#define GO_MOVE 8
#define GO_TOP 2000
#define GO_CLEAROBJ 2012
#define GO_CHECKHINT 2600
#define GO_CHECKFOO 2607
#define GO_DIRECTION 2620
#define GO_LOOKUP 2630
#define GO_WORD2 2800
#define GO_SPECIALS 1900
#define GO_UNKNOWN 8000
#define GO_ACTION 40000
#define GO_DWARFWAKE 19000
/* Special object statuses in game.place - can also be a location number (> 0) */
#define CARRIED -1 /* Player is toting it */
/* hack to ignore GCC Unused Result */
#define IGNORE(r) do{if (r){}}while(0)
/* end */ /* end */

View file

@ -469,7 +469,7 @@ hints:
turns: 4 turns: 4
penalty: 2 penalty: 2
question: 'Are you trying to get into the cave?' question: 'Are you trying to get into the cave?'
hint: | hint: |-
The grate is very solid and has a hardened steel lock. You cannot The grate is very solid and has a hardened steel lock. You cannot
enter without a key, and there are no keys nearby. I would recommend enter without a key, and there are no keys nearby. I would recommend
looking elsewhere for the keys. looking elsewhere for the keys.
@ -479,7 +479,7 @@ hints:
turns: 5 turns: 5
penalty: 2 penalty: 2
question: 'Are you trying to catch the bird?' question: 'Are you trying to catch the bird?'
hint: | hint: |-
Something about you seems to be frightening the bird. Perhaps you Something about you seems to be frightening the bird. Perhaps you
might figure out what it is. might figure out what it is.
- hint: &snake - hint: &snake
@ -488,7 +488,7 @@ hints:
turns: 8 turns: 8
penalty: 2 penalty: 2
question: 'Are you trying to somehow deal with the snake?' question: 'Are you trying to somehow deal with the snake?'
hint: | hint: |-
You can't kill the snake, or drive it away, or avoid it, or anything You can't kill the snake, or drive it away, or avoid it, or anything
like that. There is a way to get by, but you don't have the necessary like that. There is a way to get by, but you don't have the necessary
resources right now. resources right now.
@ -505,7 +505,7 @@ hints:
turns: 25 turns: 25
penalty: 5 penalty: 5
question: 'Are you trying to explore beyond the plover room?' question: 'Are you trying to explore beyond the plover room?'
hint: | hint: |-
There is a way to explore that region without having to worry about There is a way to explore that region without having to worry about
falling into a pit. None of the objects available is immediately falling into a pit. None of the objects available is immediately
useful in discovering the secret. useful in discovering the secret.
@ -529,7 +529,7 @@ hints:
turns: 25 turns: 25
penalty: 2 penalty: 2
question: 'Would you like to be shown out of the forest?' question: 'Would you like to be shown out of the forest?'
hint: | hint: |-
Go east ten times. If that doesn't get you out, then go south, then Go east ten times. If that doesn't get you out, then go south, then
west twice, then south. west twice, then south.
- hint: &ogre - hint: &ogre
@ -538,7 +538,7 @@ hints:
turns: 10 turns: 10
penalty: 4 penalty: 4
question: 'Do you need help dealing with the ogre?' question: 'Do you need help dealing with the ogre?'
hint: | hint: |-
There is nothing the presence of which will prevent you from defeating There is nothing the presence of which will prevent you from defeating
him; thus it can't hurt to fetch everything you possibly can. him; thus it can't hurt to fetch everything you possibly can.
- hint: &jade - hint: &jade
@ -547,7 +547,7 @@ hints:
turns: 1 turns: 1
penalty: 4 penalty: 4
question: 'You''re missing only one other treasure. Do you need help finding it?' question: 'You''re missing only one other treasure. Do you need help finding it?'
hint: | hint: |-
Once you''ve found all the other treasures, it is no longer possible to Once you''ve found all the other treasures, it is no longer possible to
locate the one you''re now missing.' locate the one you''re now missing.'
locations: !!omap locations: !!omap
@ -560,7 +560,7 @@ locations: !!omap
] ]
- LOC_START: - LOC_START:
description: description:
long: | long: |-
You are standing at the end of a road before a small brick building. You are standing at the end of a road before a small brick building.
Around you is a forest. A small stream flows out of the building and Around you is a forest. A small stream flows out of the building and
down a gully. down a gully.
@ -577,7 +577,7 @@ locations: !!omap
] ]
- LOC_HILL: - LOC_HILL:
description: description:
long: | long: |-
You have walked up a hill, still in the forest. The road slopes back You have walked up a hill, still in the forest. The road slopes back
down the other side of the hill. There is a building in the distance. down the other side of the hill. There is a building in the distance.
short: 'You''re at hill in road.' short: 'You''re at hill in road.'
@ -603,7 +603,7 @@ locations: !!omap
] ]
- LOC_VALLEY: - LOC_VALLEY:
description: description:
long: | long: |-
You are in a valley in the forest beside a stream tumbling along a You are in a valley in the forest beside a stream tumbling along a
rocky bed. rocky bed.
short: 'You''re in valley.' short: 'You''re in valley.'
@ -631,7 +631,7 @@ locations: !!omap
] ]
- LOC_CLIFF: - LOC_CLIFF:
description: description:
long: | long: |-
The forest thins out here to reveal a steep cliff. There is no way The forest thins out here to reveal a steep cliff. There is no way
down, but a small ledge can be seen to the west across the chasm. down, but a small ledge can be seen to the west across the chasm.
short: 'You''re at cliff.' short: 'You''re at cliff.'
@ -644,7 +644,7 @@ locations: !!omap
] ]
- LOC_SLIT: - LOC_SLIT:
description: description:
long: | long: |-
At your feet all the water of the stream splashes into a 2-inch slit At your feet all the water of the stream splashes into a 2-inch slit
in the rock. Downstream the streambed is bare rock. in the rock. Downstream the streambed is bare rock.
short: 'You''re at slit in streambed.' short: 'You''re at slit in streambed.'
@ -661,7 +661,7 @@ locations: !!omap
] ]
- LOC_GRATE: - LOC_GRATE:
description: description:
long: | long: |-
You are in a 20-foot depression floored with bare dirt. Set into the You are in a 20-foot depression floored with bare dirt. Set into the
dirt is a strong steel grate mounted in concrete. A dry streambed dirt is a strong steel grate mounted in concrete. A dry streambed
leads into the depression. leads into the depression.
@ -681,7 +681,7 @@ locations: !!omap
] ]
- LOC_BELOWGRATE: - LOC_BELOWGRATE:
description: description:
long: | long: |-
You are in a small chamber beneath a 3x3 steel grate to the surface. You are in a small chamber beneath a 3x3 steel grate to the surface.
A low crawl over cobbles leads inward to the west. A low crawl over cobbles leads inward to the west.
short: 'You''re below the grate.' short: 'You''re below the grate.'
@ -695,7 +695,7 @@ locations: !!omap
] ]
- LOC_COBBLE: - LOC_COBBLE:
description: description:
long: | long: |-
You are crawling over cobbles in a low passage. There is a dim light You are crawling over cobbles in a low passage. There is a dim light
at the east end of the passage. at the east end of the passage.
short: 'You''re in cobble crawl.' short: 'You''re in cobble crawl.'
@ -707,7 +707,7 @@ locations: !!omap
] ]
- LOC_DEBRIS: - LOC_DEBRIS:
description: description:
long: | long: |-
You are in a debris room filled with stuff washed in from the surface. You are in a debris room filled with stuff washed in from the surface.
A low wide passage with cobbles becomes plugged with mud and debris A low wide passage with cobbles becomes plugged with mud and debris
here, but an awkward canyon leads upward and west. In the mud someone here, but an awkward canyon leads upward and west. In the mud someone
@ -737,7 +737,7 @@ locations: !!omap
] ]
- LOC_BIRD: - LOC_BIRD:
description: description:
long: | long: |-
You are in a splendid chamber thirty feet high. The walls are frozen You are in a splendid chamber thirty feet high. The walls are frozen
rivers of orange stone. An awkward canyon and a good passage exit rivers of orange stone. An awkward canyon and a good passage exit
from east and west sides of the chamber. from east and west sides of the chamber.
@ -753,7 +753,7 @@ locations: !!omap
] ]
- LOC_PITTOP: - LOC_PITTOP:
description: description:
long: | long: |-
At your feet is a small pit breathing traces of white mist. An east At your feet is a small pit breathing traces of white mist. An east
passage ends here except for a small crack leading on. passage ends here except for a small crack leading on.
short: 'You''re at top of small pit.' short: 'You''re at top of small pit.'
@ -769,7 +769,7 @@ locations: !!omap
] ]
- LOC_MISTHALL: - LOC_MISTHALL:
description: description:
long: | long: |-
You are at one end of a vast hall stretching forward out of sight to You are at one end of a vast hall stretching forward out of sight to
the west. There are openings to either side. Nearby, a wide stone the west. There are openings to either side. Nearby, a wide stone
staircase leads downward. The hall is filled with wisps of white mist staircase leads downward. The hall is filled with wisps of white mist
@ -790,7 +790,7 @@ locations: !!omap
] ]
- LOC_CRACK: - LOC_CRACK:
description: description:
long: | long: |-
The crack is far too small for you to follow. At its widest it is The crack is far too small for you to follow. At its widest it is
barely wide enough to admit your foot.' barely wide enough to admit your foot.'
short: !!null short: !!null
@ -800,7 +800,7 @@ locations: !!omap
] ]
- LOC_EASTBANK: - LOC_EASTBANK:
description: description:
long: | long: |-
You are on the east bank of a fissure slicing clear across the hall. You are on the east bank of a fissure slicing clear across the hall.
The mist is quite thick here, and the fissure is too wide to jump. The mist is quite thick here, and the fissure is too wide to jump.
short: 'You''re on east bank of fissure.' short: 'You''re on east bank of fissure.'
@ -818,7 +818,7 @@ locations: !!omap
] ]
- LOC_NUGGET: - LOC_NUGGET:
description: description:
long: | long: |-
This is a low room with a crude note on the wall. The note says, This is a low room with a crude note on the wall. The note says,
"You won't get it up the steps". "You won't get it up the steps".
short: 'You''re in nugget-of-gold room.' short: 'You''re in nugget-of-gold room.'
@ -828,7 +828,7 @@ locations: !!omap
] ]
- LOC_KINGHALL: - LOC_KINGHALL:
description: description:
long: | long: |-
You are in the Hall of the Mountain King, with passages off in all You are in the Hall of the Mountain King, with passages off in all
directions. directions.
short: 'You''re in Hall of Mt King.' short: 'You''re in Hall of Mt King.'
@ -873,7 +873,7 @@ locations: !!omap
] ]
- LOC_WESTEND: - LOC_WESTEND:
description: description:
long: | long: |-
You are at the west end of the Twopit Room. There is a large hole in You are at the west end of the Twopit Room. There is a large hole in
the wall above the pit at this end of the room. the wall above the pit at this end of the room.
short: 'You''re at west end of Twopit Room.' short: 'You''re at west end of Twopit Room.'
@ -886,7 +886,7 @@ locations: !!omap
] ]
- LOC_EASTPIT: - LOC_EASTPIT:
description: description:
long: | long: |-
You are at the bottom of the eastern pit in the Twopit Room. There is You are at the bottom of the eastern pit in the Twopit Room. There is
a small pool of oil in one corner of the pit. a small pool of oil in one corner of the pit.
short: 'You''re in east pit.' short: 'You''re in east pit.'
@ -896,7 +896,7 @@ locations: !!omap
] ]
- LOC_WESTPIT: - LOC_WESTPIT:
description: description:
long: | long: |-
You are at the bottom of the western pit in the Twopit Room. There is You are at the bottom of the western pit in the Twopit Room. There is
a large hole in the wall about 25 feet above you. a large hole in the wall about 25 feet above you.
short: 'You''re in west pit.' short: 'You''re in west pit.'
@ -933,7 +933,7 @@ locations: !!omap
] ]
- LOC_FLOORHOLE: - LOC_FLOORHOLE:
description: description:
long: | long: |-
You are in a low n/s passage at a hole in the floor. The hole goes You are in a low n/s passage at a hole in the floor. The hole goes
down to an e/w passage. down to an e/w passage.
short: 'You''re in n/s passage above e/w passage.' short: 'You''re in n/s passage above e/w passage.'
@ -953,7 +953,7 @@ locations: !!omap
] ]
- LOC_WESTSIDE: - LOC_WESTSIDE:
description: description:
long: | long: |-
You are in the west side chamber of the Hall of the Mountain King. You are in the west side chamber of the Hall of the Mountain King.
A passage continues west and up here. A passage continues west and up here.
short: 'You''re in the west side chamber.' short: 'You''re in the west side chamber.'
@ -981,7 +981,7 @@ locations: !!omap
] ]
- LOC_Y2: - LOC_Y2:
description: description:
long: | long: |-
You are in a large room, with a passage to the south, a passage to the You are in a large room, with a passage to the south, a passage to the
west, and a wall of broken rock to the east. There is a large "Y2" on west, and a wall of broken rock to the east. There is a large "Y2" on
a rock in the room's center. a rock in the room's center.
@ -1006,7 +1006,7 @@ locations: !!omap
] ]
- LOC_WINDOW1: - LOC_WINDOW1:
description: description:
long: | long: |-
You're at a low window overlooking a huge pit, which extends up out of You're at a low window overlooking a huge pit, which extends up out of
sight. A floor is indistinctly visible over 50 feet below. Traces of sight. A floor is indistinctly visible over 50 feet below. Traces of
white mist cover the floor of the pit, becoming thicker to the right. white mist cover the floor of the pit, becoming thicker to the right.
@ -1022,7 +1022,7 @@ locations: !!omap
] ]
- LOC_BROKEN: - LOC_BROKEN:
description: description:
long: | long: |-
You are in a dirty broken passage. To the east is a crawl. To the You are in a dirty broken passage. To the east is a crawl. To the
west is a large passage. Above you is a hole to another passage. west is a large passage. Above you is a hole to another passage.
short: 'You''re in dirty passage.' short: 'You''re in dirty passage.'
@ -1035,7 +1035,7 @@ locations: !!omap
] ]
- LOC_SMALLPITBRINK: - LOC_SMALLPITBRINK:
description: description:
long: | long: |-
You are on the brink of a small clean climbable pit. A crawl leads You are on the brink of a small clean climbable pit. A crawl leads
west. west.
short: 'You''re at brink of small pit.' short: 'You''re at brink of small pit.'
@ -1046,7 +1046,7 @@ locations: !!omap
] ]
- LOC_SMALLPIT: - LOC_SMALLPIT:
description: description:
long: | long: |-
You are in the bottom of a small pit with a little stream, which You are in the bottom of a small pit with a little stream, which
enters and exits through tiny slits. enters and exits through tiny slits.
short: 'You''re at bottom of pit with stream.' short: 'You''re at bottom of pit with stream.'
@ -1058,7 +1058,7 @@ locations: !!omap
] ]
- LOC_DUSTY: - LOC_DUSTY:
description: description:
long: | long: |-
You are in a large room full of dusty rocks. There is a big hole in You are in a large room full of dusty rocks. There is a big hole in
the floor. There are cracks everywhere, and a passage leading east. the floor. There are cracks everywhere, and a passage leading east.
short: 'You''re in dusty rock room.' short: 'You''re in dusty rock room.'
@ -1070,7 +1070,7 @@ locations: !!omap
] ]
- LOC_PARALLEL1: - LOC_PARALLEL1:
description: description:
long: | long: |-
You have crawled through a very low wide passage parallel to and north You have crawled through a very low wide passage parallel to and north
of the Hall of Mists. of the Hall of Mists.
short: !!null short: !!null
@ -1080,7 +1080,7 @@ locations: !!omap
] ]
- LOC_MISTWEST: - LOC_MISTWEST:
description: description:
long: | long: |-
You are at the west end of the Hall of Mists. A low wide crawl You are at the west end of the Hall of Mists. A low wide crawl
continues west and another goes north. To the south is a little continues west and another goes north. To the south is a little
passage 6 feet off the floor. passage 6 feet off the floor.
@ -1259,7 +1259,7 @@ locations: !!omap
] ]
- LOC_PITBRINK: - LOC_PITBRINK:
description: description:
long: | long: |-
You are on the brink of a thirty foot pit with a massive orange column You are on the brink of a thirty foot pit with a massive orange column
down one wall. You could climb down here but you could not get back down one wall. You could climb down here but you could not get back
up. The maze continues at this level. up. The maze continues at this level.
@ -1282,7 +1282,7 @@ locations: !!omap
] ]
- LOC_PARALLEL2: - LOC_PARALLEL2:
description: description:
long: | long: |-
You have crawled through a very low wide passage parallel to and north You have crawled through a very low wide passage parallel to and north
of the Hall of Mists. of the Hall of Mists.
short: !!null short: !!null
@ -1292,7 +1292,7 @@ locations: !!omap
] ]
- LOC_LONGEAST: - LOC_LONGEAST:
description: description:
long: | long: |-
You are at the east end of a very long hall apparently without side You are at the east end of a very long hall apparently without side
chambers. To the east a low wide crawl slants up. To the north a chambers. To the east a low wide crawl slants up. To the north a
round two foot hole slants down. round two foot hole slants down.
@ -1305,7 +1305,7 @@ locations: !!omap
] ]
- LOC_LONGWEST: - LOC_LONGWEST:
description: description:
long: | long: |-
You are at the west end of a very long featureless hall. The hall You are at the west end of a very long featureless hall. The hall
joins up with a narrow north/south passage. joins up with a narrow north/south passage.
short: 'You''re at west end of long hall.' short: 'You''re at west end of long hall.'
@ -1336,7 +1336,7 @@ locations: !!omap
] ]
- LOC_COMPLEX: - LOC_COMPLEX:
description: description:
long: | long: |-
You are at a complex junction. A low hands and knees passage from the You are at a complex junction. A low hands and knees passage from the
north joins a higher crawl from the east to make a walking passage north joins a higher crawl from the east to make a walking passage
going west. There is also a large room above. The air is damp here. going west. There is also a large room above. The air is damp here.
@ -1352,7 +1352,7 @@ locations: !!omap
] ]
- LOC_BEDQUILT: - LOC_BEDQUILT:
description: description:
long: | long: |-
You are in Bedquilt, a long east/west passage with holes everywhere. You are in Bedquilt, a long east/west passage with holes everywhere.
To explore at random select north, south, up, or down. To explore at random select north, south, up, or down.
short: 'You''re in Bedquilt.' short: 'You''re in Bedquilt.'
@ -1373,7 +1373,7 @@ locations: !!omap
] ]
- LOC_SWISSCHEESE: - LOC_SWISSCHEESE:
description: description:
long: | long: |-
You are in a room whose walls resemble swiss cheese. Obvious passages You are in a room whose walls resemble swiss cheese. Obvious passages
go west, east, ne, and nw. Part of the room is occupied by a large go west, east, ne, and nw. Part of the room is occupied by a large
bedrock block. bedrock block.
@ -1390,7 +1390,7 @@ locations: !!omap
] ]
- LOC_EASTEND: - LOC_EASTEND:
description: description:
long: | long: |-
You are at the east end of the Twopit Room. The floor here is You are at the east end of the Twopit Room. The floor here is
littered with thin rock slabs, which make it easy to descend the pits. littered with thin rock slabs, which make it easy to descend the pits.
There is a path here bypassing the pits to connect passages from east There is a path here bypassing the pits to connect passages from east
@ -1405,7 +1405,7 @@ locations: !!omap
] ]
- LOC_SLAB: - LOC_SLAB:
description: description:
long: | long: |-
You are in a large low circular chamber whose floor is an immense slab You are in a large low circular chamber whose floor is an immense slab
fallen from the ceiling (Slab Room). East and west there once were fallen from the ceiling (Slab Room). East and west there once were
large passages, but they are now filled with boulders. Low small large passages, but they are now filled with boulders. Low small
@ -1443,7 +1443,7 @@ locations: !!omap
] ]
- LOC_THREEJUNCTION: - LOC_THREEJUNCTION:
description: description:
long: | long: |-
You are in a secret canyon at a junction of three canyons, bearing You are in a secret canyon at a junction of three canyons, bearing
north, south, and se. The north one is as tall as the other two north, south, and se. The north one is as tall as the other two
combined. combined.
@ -1475,7 +1475,7 @@ locations: !!omap
] ]
- LOC_SECRET3: - LOC_SECRET3:
description: description:
long: | long: |-
You are in a secret canyon which here runs e/w. It crosses over a You are in a secret canyon which here runs e/w. It crosses over a
very tight canyon 15 feet below. If you go down you may not be able very tight canyon 15 feet below. If you go down you may not be able
to get back up. to get back up.
@ -1506,7 +1506,7 @@ locations: !!omap
] ]
- LOC_TALL: - LOC_TALL:
description: description:
long: | long: |-
You are in a tall e/w canyon. A low tight crawl goes 3 feet north and You are in a tall e/w canyon. A low tight crawl goes 3 feet north and
seems to open up. seems to open up.
short: !!null short: !!null
@ -1526,7 +1526,7 @@ locations: !!omap
] ]
- LOC_SEWER: - LOC_SEWER:
description: description:
long: | long: |-
The stream flows out through a pair of 1 foot diameter sewer pipes. The stream flows out through a pair of 1 foot diameter sewer pipes.
It would be advisable to use the exit. It would be advisable to use the exit.
short: !!null short: !!null
@ -1612,7 +1612,7 @@ locations: !!omap
] ]
- LOC_NARROW: - LOC_NARROW:
description: description:
long: | long: |-
You are in a long, narrow corridor stretching out of sight to the You are in a long, narrow corridor stretching out of sight to the
west. At the eastern end is a hole through which you can see a west. At the eastern end is a hole through which you can see a
profusion of leaves. profusion of leaves.
@ -1641,7 +1641,7 @@ locations: !!omap
] ]
- LOC_INCLINE: - LOC_INCLINE:
description: description:
long: | long: |-
You are at the top of a steep incline above a large room. You could You are at the top of a steep incline above a large room. You could
climb down here, but you would not be able to climb up. There is a climb down here, but you would not be able to climb up. There is a
passage leading back to the north. passage leading back to the north.
@ -1653,7 +1653,7 @@ locations: !!omap
] ]
- LOC_GIANTROOM: - LOC_GIANTROOM:
description: description:
long: | long: |-
You are in the Giant Room. The ceiling here is too high up for your You are in the Giant Room. The ceiling here is too high up for your
lamp to show it. Cavernous passages lead east, north, and south. On lamp to show it. Cavernous passages lead east, north, and south. On
the west wall is scrawled the inscription, "FEE FIE FOE FOO" [sic]. the west wall is scrawled the inscription, "FEE FIE FOE FOO" [sic].
@ -1686,7 +1686,7 @@ locations: !!omap
] ]
- LOC_WATERFALL: - LOC_WATERFALL:
description: description:
long: | long: |-
You are in a magnificent cavern with a rushing stream, which cascades You are in a magnificent cavern with a rushing stream, which cascades
over a sparkling waterfall into a roaring whirlpool which disappears over a sparkling waterfall into a roaring whirlpool which disappears
through a hole in the floor. Passages exit to the south and west. through a hole in the floor. Passages exit to the south and west.
@ -1700,7 +1700,7 @@ locations: !!omap
] ]
- LOC_SOFTROOM: - LOC_SOFTROOM:
description: description:
long: | long: |-
You are in the Soft Room. The walls are covered with heavy curtains, You are in the Soft Room. The walls are covered with heavy curtains,
the floor with a thick pile carpet. Moss covers the ceiling. the floor with a thick pile carpet. Moss covers the ceiling.
short: 'You''re in Soft Room.' short: 'You''re in Soft Room.'
@ -1710,7 +1710,7 @@ locations: !!omap
] ]
- LOC_ORIENTAL: - LOC_ORIENTAL:
description: description:
long: | long: |-
This is the Oriental Room. Ancient oriental cave drawings cover the This is the Oriental Room. Ancient oriental cave drawings cover the
walls. A gently sloping passage leads upward to the north, another walls. A gently sloping passage leads upward to the north, another
passage leads se, and a hands and knees crawl leads west. passage leads se, and a hands and knees crawl leads west.
@ -1723,7 +1723,7 @@ locations: !!omap
] ]
- LOC_MISTY: - LOC_MISTY:
description: description:
long: | long: |-
You are following a wide path around the outer edge of a large cavern. You are following a wide path around the outer edge of a large cavern.
Far below, through a heavy white mist, strange splashing noises can be Far below, through a heavy white mist, strange splashing noises can be
heard. The mist rises up through a fissure in the ceiling. The path heard. The mist rises up through a fissure in the ceiling. The path
@ -1737,7 +1737,7 @@ locations: !!omap
] ]
- LOC_ALCOVE: - LOC_ALCOVE:
description: description:
long: | long: |-
You are in an alcove. A small nw path seems to widen after a short You are in an alcove. A small nw path seems to widen after a short
distance. An extremely tight tunnel leads east. It looks like a very distance. An extremely tight tunnel leads east. It looks like a very
tight squeeze. An eerie light can be seen at the other end. tight squeeze. An eerie light can be seen at the other end.
@ -1751,7 +1751,7 @@ locations: !!omap
] ]
- LOC_PLOVER: - LOC_PLOVER:
description: description:
long: | long: |-
You're in a small chamber lit by an eerie green light. An extremely You're in a small chamber lit by an eerie green light. An extremely
narrow tunnel exits to the west. A dark corridor leads ne. narrow tunnel exits to the west. A dark corridor leads ne.
short: 'You''re in Plover Room.' short: 'You''re in Plover Room.'
@ -1775,7 +1775,7 @@ locations: !!omap
] ]
- LOC_ARCHED: - LOC_ARCHED:
description: description:
long: | long: |-
You are in an arched hall. A coral passage once continued up and east You are in an arched hall. A coral passage once continued up and east
from here, but is now blocked by debris. The air smells of sea water. from here, but is now blocked by debris. The air smells of sea water.
short: 'You''re in arched hall.' short: 'You''re in arched hall.'
@ -1785,7 +1785,7 @@ locations: !!omap
] ]
- LOC_SHELLROOM: - LOC_SHELLROOM:
description: description:
long: | long: |-
You're in a large room carved out of sedimentary rock. The floor and You're in a large room carved out of sedimentary rock. The floor and
walls are littered with bits of shells imbedded in the stone. A walls are littered with bits of shells imbedded in the stone. A
shallow passage proceeds downward, and a somewhat steeper one leads shallow passage proceeds downward, and a somewhat steeper one leads
@ -1821,7 +1821,7 @@ locations: !!omap
] ]
- LOC_ANTEROOM: - LOC_ANTEROOM:
description: description:
long: | long: |-
You are in an anteroom leading to a large passage to the east. Small You are in an anteroom leading to a large passage to the east. Small
passages go west and up. The remnants of recent digging are evident. passages go west and up. The remnants of recent digging are evident.
A sign in midair here says "Cave under construction beyond this point. A sign in midair here says "Cave under construction beyond this point.
@ -1863,7 +1863,7 @@ locations: !!omap
] ]
- LOC_MIRRORCANYON: - LOC_MIRRORCANYON:
description: description:
long: | long: |-
You are in a north/south canyon about 25 feet across. The floor is You are in a north/south canyon about 25 feet across. The floor is
covered by white mist seeping in from the north. The walls extend covered by white mist seeping in from the north. The walls extend
upward for well over 100 feet. Suspended from some unseen point far upward for well over 100 feet. Suspended from some unseen point far
@ -1881,7 +1881,7 @@ locations: !!omap
] ]
- LOC_WINDOW2: - LOC_WINDOW2:
description: description:
long: | long: |-
You're at a low window overlooking a huge pit, which extends up out of You're at a low window overlooking a huge pit, which extends up out of
sight. A floor is indistinctly visible over 50 feet below. Traces of sight. A floor is indistinctly visible over 50 feet below. Traces of
white mist cover the floor of the pit, becoming thicker to the left. white mist cover the floor of the pit, becoming thicker to the left.
@ -1897,7 +1897,7 @@ locations: !!omap
] ]
- LOC_TOPSTALACTITE: - LOC_TOPSTALACTITE:
description: description:
long: | long: |-
A large stalactite extends from the roof and almost reaches the floor A large stalactite extends from the roof and almost reaches the floor
below. You could climb down it, and jump from it to the floor, but below. You could climb down it, and jump from it to the floor, but
having done so you would be unable to reach it to climb back up. having done so you would be unable to reach it to climb back up.
@ -1929,7 +1929,7 @@ locations: !!omap
] ]
- LOC_RESERVOIR: - LOC_RESERVOIR:
description: description:
long: | long: |-
You are at the edge of a large underground reservoir. An opaque cloud You are at the edge of a large underground reservoir. An opaque cloud
of white mist fills the room and rises rapidly upward. The lake is of white mist fills the room and rises rapidly upward. The lake is
fed by a stream, which tumbles out of a hole in the wall about 10 feet fed by a stream, which tumbles out of a hole in the wall about 10 feet
@ -1953,7 +1953,7 @@ locations: !!omap
] ]
- LOC_NE: - LOC_NE:
description: description:
long: | long: |-
You are at the northeast end of an immense room, even larger than the You are at the northeast end of an immense room, even larger than the
Giant Room. It appears to be a repository for the "Adventure" Giant Room. It appears to be a repository for the "Adventure"
program. Massive torches far overhead bathe the room with smoky program. Massive torches far overhead bathe the room with smoky
@ -1973,7 +1973,7 @@ locations: !!omap
] ]
- LOC_SW: - LOC_SW:
description: description:
long: | long: |-
You are at the southwest end of the repository. To one side is a pit You are at the southwest end of the repository. To one side is a pit
full of fierce green snakes. On the other side is a row of small full of fierce green snakes. On the other side is a row of small
wicker cages, each of which contains a little sulking bird. In one wicker cages, each of which contains a little sulking bird. In one
@ -1991,7 +1991,7 @@ locations: !!omap
] ]
- LOC_SWCHASM: - LOC_SWCHASM:
description: description:
long: | long: |-
You are on one side of a large, deep chasm. A heavy white mist rising You are on one side of a large, deep chasm. A heavy white mist rising
up from below obscures all view of the far side. A sw path leads away up from below obscures all view of the far side. A sw path leads away
from the chasm into a winding corridor. from the chasm into a winding corridor.
@ -2010,7 +2010,7 @@ locations: !!omap
] ]
- LOC_WINDING: - LOC_WINDING:
description: description:
long: | long: |-
You are in a long winding corridor sloping out of sight in both You are in a long winding corridor sloping out of sight in both
directions. directions.
short: 'You''re in sloping corridor.' short: 'You''re in sloping corridor.'
@ -2048,7 +2048,7 @@ locations: !!omap
] ]
- LOC_NECHASM: - LOC_NECHASM:
description: description:
long: | long: |-
You are on the far side of the chasm. A ne path leads away from the You are on the far side of the chasm. A ne path leads away from the
chasm on this side. chasm on this side.
short: 'You''re on ne side of chasm.' short: 'You''re on ne side of chasm.'
@ -2064,7 +2064,7 @@ locations: !!omap
] ]
- LOC_CORRIDOR: - LOC_CORRIDOR:
description: description:
long: | long: |-
You're in a long east/west corridor. A faint rumbling noise can be You're in a long east/west corridor. A faint rumbling noise can be
heard in the distance. heard in the distance.
short: 'You''re in corridor.' short: 'You''re in corridor.'
@ -2078,7 +2078,7 @@ locations: !!omap
] ]
- LOC_FORK: - LOC_FORK:
description: description:
long: | long: |-
The path forks here. The left fork leads northeast. A dull rumbling The path forks here. The left fork leads northeast. A dull rumbling
seems to get louder in that direction. The right fork leads southeast seems to get louder in that direction. The right fork leads southeast
down a gentle slope. The main corridor enters from the west. down a gentle slope. The main corridor enters from the west.
@ -2094,7 +2094,7 @@ locations: !!omap
] ]
- LOC_WARMWALLS: - LOC_WARMWALLS:
description: description:
long: | long: |-
The walls are quite warm here. From the north can be heard a steady The walls are quite warm here. From the north can be heard a steady
roar, so loud that the entire cave seems to be trembling. Another roar, so loud that the entire cave seems to be trembling. Another
passage leads south, and a low crawl goes east. passage leads south, and a low crawl goes east.
@ -2108,7 +2108,7 @@ locations: !!omap
] ]
- LOC_BREATHTAKING: - LOC_BREATHTAKING:
description: description:
long: | long: |-
You are on the edge of a breath-taking view. Far below you is an You are on the edge of a breath-taking view. Far below you is an
active volcano, from which great gouts of molten lava come surging active volcano, from which great gouts of molten lava come surging
out, cascading back down into the depths. The glowing rock fills the out, cascading back down into the depths. The glowing rock fills the
@ -2141,7 +2141,7 @@ locations: !!omap
] ]
- LOC_BOULDERS2: - LOC_BOULDERS2:
description: description:
long: | long: |-
You are in a small chamber filled with large boulders. The walls are You are in a small chamber filled with large boulders. The walls are
very warm, causing the air in the room to be almost stifling from the very warm, causing the air in the room to be almost stifling from the
heat. The only exit is a crawl heading west, through which is coming heat. The only exit is a crawl heading west, through which is coming
@ -2168,7 +2168,7 @@ locations: !!omap
] ]
- LOC_BARRENFRONT: - LOC_BARRENFRONT:
description: description:
long: | long: |-
You are standing at the entrance to a large, barren room. A notice You are standing at the entrance to a large, barren room. A notice
above the entrance reads: "Caution! Bear in room!" above the entrance reads: "Caution! Bear in room!"
short: 'You''re in front of Barren Room.' short: 'You''re in front of Barren Room.'
@ -2182,7 +2182,7 @@ locations: !!omap
] ]
- LOC_BARRENROOM: - LOC_BARRENROOM:
description: description:
long: | long: |-
You are inside a barren room. The center of the room is completely You are inside a barren room. The center of the room is completely
empty except for some dust. Marks in the dust lead away toward the empty except for some dust. Marks in the dust lead away toward the
far end of the room. The only exit is the way you came in. far end of the room. The only exit is the way you came in.
@ -2652,7 +2652,7 @@ locations: !!omap
] ]
- LOC_LEDGE: - LOC_LEDGE:
description: description:
long: | long: |-
You are on a small ledge on one face of a sheer cliff. There are no You are on a small ledge on one face of a sheer cliff. There are no
paths away from the ledge. Across the chasm is a small clearing paths away from the ledge. Across the chasm is a small clearing
surrounded by forest. surrounded by forest.
@ -2663,7 +2663,7 @@ locations: !!omap
] ]
- LOC_RESBOTTOM: - LOC_RESBOTTOM:
description: description:
long: | long: |-
You are walking across the bottom of the reservoir. Walls of water You are walking across the bottom of the reservoir. Walls of water
rear up on either side. The roar of the water cascading past is rear up on either side. The roar of the water cascading past is
nearly deafening, and the mist is so thick you can barely see. nearly deafening, and the mist is so thick you can barely see.
@ -2677,7 +2677,7 @@ locations: !!omap
] ]
- LOC_RESNORTH: - LOC_RESNORTH:
description: description:
long: | long: |-
You are at the northern edge of the reservoir. A northwest passage You are at the northern edge of the reservoir. A northwest passage
leads sharply up from here. leads sharply up from here.
short: 'You''re north of reservoir.' short: 'You''re north of reservoir.'
@ -2708,7 +2708,7 @@ locations: !!omap
] ]
- LOC_CLIFFBASE: - LOC_CLIFFBASE:
description: description:
long: | long: |-
You are at the base of a nearly vertical cliff. There are some You are at the base of a nearly vertical cliff. There are some
slim footholds which would enable you to climb up, but it looks slim footholds which would enable you to climb up, but it looks
extremely dangerous. Here at the base of the cliff lie the remains extremely dangerous. Here at the base of the cliff lie the remains
@ -2731,7 +2731,7 @@ locations: !!omap
] ]
- LOC_FOOTSLIP: - LOC_FOOTSLIP:
description: description:
long: | long: |-
Just as you reach the top, your foot slips on a loose rock and you Just as you reach the top, your foot slips on a loose rock and you
tumble several hundred feet to join the other unlucky adventurers. tumble several hundred feet to join the other unlucky adventurers.
short: !!null short: !!null
@ -2741,7 +2741,7 @@ locations: !!omap
] ]
- LOC_CLIFFTOP: - LOC_CLIFFTOP:
description: description:
long: | long: |-
Just as you reach the top, your foot slips on a loose rock and you Just as you reach the top, your foot slips on a loose rock and you
make one last desperate grab. Your luck holds, as does your grip. make one last desperate grab. Your luck holds, as does your grip.
With an enormous heave, you lift yourself to the ledge above. With an enormous heave, you lift yourself to the ledge above.
@ -2752,7 +2752,7 @@ locations: !!omap
] ]
- LOC_CLIFFLEDGE: - LOC_CLIFFLEDGE:
description: description:
long: | long: |-
You are on a small ledge at the top of a nearly vertical cliff. You are on a small ledge at the top of a nearly vertical cliff.
There is a low crawl leading off to the northeast. There is a low crawl leading off to the northeast.
short: 'You''re at top of cliff.' short: 'You''re at top of cliff.'
@ -2828,7 +2828,7 @@ locations: !!omap
arbitrary_messages: !!omap arbitrary_messages: !!omap
- NO_MESSAGE: !!null - NO_MESSAGE: !!null
- CAVE_NEARBY: | - CAVE_NEARBY: |-
Somewhere nearby is Colossal Cave, where others have found fortunes in Somewhere nearby is Colossal Cave, where others have found fortunes in
treasure and gold, though it is rumored that some who enter are never treasure and gold, though it is rumored that some who enter are never
seen again. Magic is said to work in the cave. I will be your eyes seen again. Magic is said to work in the cave. I will be your eyes
@ -2841,7 +2841,7 @@ arbitrary_messages: !!omap
This program was originally developed by Willie Crowther. Most of the This program was originally developed by Willie Crowther. Most of the
features of the current program were added by Don Woods. features of the current program were added by Don Woods.
- DWARF_BLOCK: 'A little dwarf with a big knife blocks your way.' - DWARF_BLOCK: 'A little dwarf with a big knife blocks your way.'
- DWARF_RAN: | - DWARF_RAN: |-
A little dwarf just walked around a corner, saw you, threw a little A little dwarf just walked around a corner, saw you, threw a little
axe at you which missed, cursed, and ran away. axe at you which missed, cursed, and ran away.
- DWARF_PACK: 'There are %d threatening little dwarves in the room with you.' - DWARF_PACK: 'There are %d threatening little dwarves in the room with you.'
@ -2855,7 +2855,7 @@ arbitrary_messages: !!omap
- CANT_APPLY: 'I don''t know how to apply that word here.' - CANT_APPLY: 'I don''t know how to apply that word here.'
- YOUR_WELCOME: 'You''re quite welcome.' - YOUR_WELCOME: 'You''re quite welcome.'
- AM_GAME: 'I''m game. Would you care to explain how?' - AM_GAME: 'I''m game. Would you care to explain how?'
- NO_MORE_DETAIL: | - NO_MORE_DETAIL: |-
Sorry, but I am not allowed to give more detail. I will repeat the Sorry, but I am not allowed to give more detail. I will repeat the
long description of your location. long description of your location.
- PITCH_DARK: 'It is now pitch dark. If you proceed you will likely fall into a pit.' - PITCH_DARK: 'It is now pitch dark. If you proceed you will likely fall into a pit.'
@ -2885,7 +2885,7 @@ arbitrary_messages: !!omap
- DWARF_DODGES: 'You attack a little dwarf, but he dodges out of the way.' - DWARF_DODGES: 'You attack a little dwarf, but he dodges out of the way.'
- BARE_HANDS_QUERY: 'With what? Your bare hands?' - BARE_HANDS_QUERY: 'With what? Your bare hands?'
- WORN_OUT: 'Good try, but that is an old worn-out magic word.' - WORN_OUT: 'Good try, but that is an old worn-out magic word.'
- VOCAB_DESCRIPTION: | - VOCAB_DESCRIPTION: |-
I know of places, actions, and things. Most of my vocabulary I know of places, actions, and things. Most of my vocabulary
describes places and is used to move you there. To move, try words describes places and is used to move you there. To move, try words
like forest, building, downstream, enter, east, west, north, south, like forest, building, downstream, enter, east, west, north, south,
@ -2919,19 +2919,19 @@ arbitrary_messages: !!omap
- TWO_WORDS: 'Please stick to 1- and 2-word commands.' - TWO_WORDS: 'Please stick to 1- and 2-word commands.'
- OK_MAN: 'OK' - OK_MAN: 'OK'
- CANNOT_UNLOCK: 'You can''t unlock the keys.' - CANNOT_UNLOCK: 'You can''t unlock the keys.'
- FUTILE_CRAWL: | - FUTILE_CRAWL: |-
You have crawled around in some little holes and wound up back in the You have crawled around in some little holes and wound up back in the
main passage. main passage.
- FOLLOW_STREAM: | - FOLLOW_STREAM: |-
I don't know where the cave is, but hereabouts no stream can run on I don't know where the cave is, but hereabouts no stream can run on
the surface for long. I would try the stream. the surface for long. I would try the stream.
- NEED_DETAIL: 'I need more detailed instructions to do that.' - NEED_DETAIL: 'I need more detailed instructions to do that.'
- NEARBY: | - NEARBY: |-
I can only tell you what you see as you move about and manipulate I can only tell you what you see as you move about and manipulate
things. I cannot tell you where remote things are. things. I cannot tell you where remote things are.
- OGRE_SNARL: 'The ogre snarls and shoves you back.' - OGRE_SNARL: 'The ogre snarls and shoves you back.'
- HUH_MAN: 'Huh?' - HUH_MAN: 'Huh?'
- FOREST_LOOK: | - FOREST_LOOK: |-
The trees of the forest are large hardwood oak and maple, with an The trees of the forest are large hardwood oak and maple, with an
occasional grove of pine or spruce. There is quite a bit of under- occasional grove of pine or spruce. There is quite a bit of under-
growth, largely birch and ash saplings plus nondescript bushes of growth, largely birch and ash saplings plus nondescript bushes of
@ -2939,12 +2939,12 @@ arbitrary_messages: !!omap
all the leaves, but travel is quite easy if you detour around the all the leaves, but travel is quite easy if you detour around the
spruce and berry bushes. spruce and berry bushes.
- WELCOME_YOU: 'Welcome to Adventure!! Would you like instructions?' - WELCOME_YOU: 'Welcome to Adventure!! Would you like instructions?'
- DIGGING_FUTILE: | - DIGGING_FUTILE: |-
Digging without a shovel is quite impractical. Even with a shovel Digging without a shovel is quite impractical. Even with a shovel
progress is unlikely. progress is unlikely.
- REQUIRES_DYNAMITE: 'Blasting requires dynamite.' - REQUIRES_DYNAMITE: 'Blasting requires dynamite.'
- IM_CONFUSED: 'I''m as confused as you are.' - IM_CONFUSED: 'I''m as confused as you are.'
- EXPLAIN_MIST: | - EXPLAIN_MIST: |-
Mist is a white vapor, usually water, seen from time to time in Mist is a white vapor, usually water, seen from time to time in
caverns. It can be found anywhere but is frequently a sign of a deep caverns. It can be found anywhere but is frequently a sign of a deep
pit leading down to water.' pit leading down to water.'
@ -3010,7 +3010,7 @@ arbitrary_messages: !!omap
- STOP_UNKNOWN: 'I don''t know the word "stop". Use "quit" if you want to give up.' - STOP_UNKNOWN: 'I don''t know the word "stop". Use "quit" if you want to give up.'
- NOT_CONNECTED: 'You can''t get there from here.' - NOT_CONNECTED: 'You can''t get there from here.'
- TAME_BEAR: 'You are being followed by a very large, tame bear.' - TAME_BEAR: 'You are being followed by a very large, tame bear.'
- QUICK_START: | - QUICK_START: |-
For a summary of the most recent changes to the game, say "news". For a summary of the most recent changes to the game, say "news".
If you want to end your adventure early, say "quit". To suspend your If you want to end your adventure early, say "quit". To suspend your
adventure such that you can continue later, say "suspend" (or "pause" adventure such that you can continue later, say "suspend" (or "pause"
@ -3038,7 +3038,7 @@ arbitrary_messages: !!omap
- BEYOND_POWER: 'It is beyond your power to do that.' - BEYOND_POWER: 'It is beyond your power to do that.'
- NOT_KNOWHOW: 'I don''t know how.' - NOT_KNOWHOW: 'I don''t know how.'
- TOO_FAR: 'It is too far up for you to reach.' - TOO_FAR: 'It is too far up for you to reach.'
- DWARF_SMOKE: | - DWARF_SMOKE: |-
You killed a little dwarf. The body vanishes in a cloud of greasy You killed a little dwarf. The body vanishes in a cloud of greasy
black smoke. black smoke.
- SHELL_IMPERVIOUS: 'The shell is very strong and is impervious to attack.' - SHELL_IMPERVIOUS: 'The shell is very strong and is impervious to attack.'
@ -3764,22 +3764,22 @@ objects: !!omap
- 'There is a richly-carved ebony statuette here!' - 'There is a richly-carved ebony statuette here!'
obituaries: obituaries:
- query: | - query: |-
Oh dear, you seem to have gotten yourself killed. I might be able to 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 help you out, but I've never really done this before. Do you want me
to try to reincarnate you? to try to reincarnate you?
yes_response: | yes_response: |-
All right. But don't blame me if something goes wr...... All right. But don't blame me if something goes wr......
--- POOF!! --- --- POOF!! ---
You are engulfed in a cloud of orange smoke. Coughing and gasping, You are engulfed in a cloud of orange smoke. Coughing and gasping,
you emerge from the smoke and find.... you emerge from the smoke and find....
- query: | - query: |-
You clumsy oaf, you've done it again! I don''t know how long I can 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? keep this up. Do you want me to try reincarnating you again?
yes_response: | yes_response: |-
Okay, now where did I put my orange smoke?.... >POOF!< Okay, now where did I put my orange smoke?.... >POOF!<
Everything disappears in a dense cloud of orange smoke. Everything disappears in a dense cloud of orange smoke.
- query: | - query: |-
Now you''ve really done it! I'm out of orange smoke! You don''t expect Now you''ve really done it! I'm out of orange smoke! You don''t expect
me to do a decent reincarnation without any orange smoke, do you? me to do a decent reincarnation without any orange smoke, do you?
yes_response: 'Okay, if you''re so smart, do it yourself! I''m leaving!' yes_response: 'Okay, if you''re so smart, do it yourself! I''m leaving!'

View file

@ -1,4 +1,3 @@
#define DEFINE_GLOBALS_FROM_INCLUDES
#include <getopt.h> #include <getopt.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -51,7 +50,7 @@ int main(int argc, char *argv[])
" -v version number of save format.\n"); " -v version number of save format.\n");
fprintf(stderr, fprintf(stderr,
" -o file name of save game to write.\n"); " -o file name of save game to write.\n");
exit(-1); exit(EXIT_FAILURE);
break; break;
} }
} }
@ -61,7 +60,7 @@ int main(int argc, char *argv[])
usage, argv[0]); usage, argv[0]);
fprintf(stderr, fprintf(stderr,
"ERROR: filename required\n"); "ERROR: filename required\n");
exit(-1); exit(EXIT_FAILURE);
} }
FILE *fp = NULL; FILE *fp = NULL;
@ -89,7 +88,7 @@ int main(int argc, char *argv[])
if (fp == NULL) { if (fp == NULL) {
fprintf(stderr, fprintf(stderr,
"Can't open file %s. Exiting.\n", savefilename); "Can't open file %s. Exiting.\n", savefilename);
exit(-1); exit(EXIT_FAILURE);
} }
savefile(fp, version); savefile(fp, version);

6
main.c
View file

@ -13,7 +13,7 @@
* and for the offensive globals. Applying the Structured Program * and for the offensive globals. Applying the Structured Program
* Theorem can be hard. * Theorem can be hard.
*/ */
#define DEFINE_GLOBALS_FROM_INCLUDES
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdbool.h> #include <stdbool.h>
@ -42,7 +42,7 @@ static void sig_handler(int signo)
if (logfp != NULL) if (logfp != NULL)
fflush(logfp); fflush(logfp);
} }
exit(0); exit(EXIT_FAILURE);
} }
// LCOV_EXCL_STOP // LCOV_EXCL_STOP
@ -113,7 +113,7 @@ int main(int argc, char *argv[])
#endif #endif
fprintf(stderr, fprintf(stderr,
" -s suppress command editing\n"); " -s suppress command editing\n");
exit(-1); exit(EXIT_FAILURE);
break; break;
} }
} }

5
misc.c
View file

@ -243,11 +243,6 @@ void vspeak(const char* msg, va_list ap)
} }
*renderp = 0; *renderp = 0;
// Deal with messages that are in YAML block format and therefore
// have their own trailing \n
if (renderp > rendered && renderp[-1] == '\n')
*--renderp = '\0';
// Print the message. // Print the message.
printf("%s\n", rendered); printf("%s\n", rendered);

View file

@ -38,7 +38,7 @@ int savefile(FILE *fp, long version)
save.version = (version == 0) ? VRSION : version; save.version = (version == 0) ? VRSION : version;
memcpy(&save.game, &game, sizeof(struct game_t)); memcpy(&save.game, &game, sizeof(struct game_t));
IGNORE(fwrite(&save, sizeof(struct save_t), 1, fp)); fwrite(&save, sizeof(struct save_t), 1, fp);
return (0); return (0);
} }
@ -73,7 +73,7 @@ int suspend(void)
savefile(fp, VRSION); savefile(fp, VRSION);
fclose(fp); fclose(fp);
rspeak(RESUME_HELP); rspeak(RESUME_HELP);
exit(0); exit(EXIT_SUCCESS);
} }
int resume(void) int resume(void)
@ -114,7 +114,7 @@ int restore(FILE* fp)
return GO_UNKNOWN; return GO_UNKNOWN;
#endif #endif
IGNORE(fread(&save, sizeof(struct save_t), 1, fp)); fread(&save, sizeof(struct save_t), 1, fp);
fclose(fp); fclose(fp);
if (save.version != VRSION) { if (save.version != VRSION) {
rspeak(VERSION_SKEW, save.version / 10, MOD(save.version, 10), VRSION / 10, MOD(VRSION, 10)); rspeak(VERSION_SKEW, save.version / 10, MOD(save.version, 10), VRSION / 10, MOD(VRSION, 10));

View file

@ -125,12 +125,12 @@ void terminate(enum termination mode)
speak(classes[i].message); speak(classes[i].message);
i = classes[i].threshold + 1 - points; i = classes[i].threshold + 1 - points;
rspeak(NEXT_HIGHER, i, i); rspeak(NEXT_HIGHER, i, i);
exit(0); exit(EXIT_SUCCESS);
} }
} }
rspeak(OFF_SCALE); rspeak(OFF_SCALE);
rspeak(NO_HIGHER); rspeak(NO_HIGHER);
exit(0); exit(EXIT_SUCCESS);
} }
/* end */ /* end */