lukem [Tue, 9 Jan 2001 23:49:54 +0000 (23:49 +0000)]
- openlog "huntd" instead of "HUNT"
- consistently log non-critical errors at LOG_WARNING not LOG_ERR
- consistently use positive numbers for exit() and _exit()
- one warning was using printf() instead of syslog()
jwise [Thu, 4 Jan 2001 03:51:23 +0000 (03:51 +0000)]
More rationalization of include files:
a.) Don't include a zillion system headers from "extern.h" (actually, don't
include any).
b.) Break a global jmp_buf variable into a new file, so <setjmp.h> doesn't
have to be pulled in everywhere (it's only used in two places).
The (one line) new file is (c) TNF with a three-clause license, FW(L)IW.
jwise [Thu, 4 Jan 2001 03:21:16 +0000 (03:21 +0000)]
Rationalize inclusion of header files: cut down on `include everything
everywhere' a little (more to go), and as per KNF, local includes after
system includes.
In cypher(), don't attempt to make sense of words other than VERBs or
KNIFE when a verb is required. Add AUXVERB for "make", "move",
"climb" (as in "make love", "climb up") and ignore AUXVERB as a verb,
going on to the next word, instead of treating these words as
adjectives. When creating new verbs from "put on", "put down", "take
off", mark them as type VERB. Mostly from Paul Janzen
<pjanzen@foatdi.harvard.edu>.
Add OBJ_AN flag to objflags so as to use "a" or "an" appropriately in
messages; avoids "a amulet", "a Elf". Define and use macros to use
"a", "an", "the", "is", "are" appropriately. Partly based on OpenBSD.
Give a better message for trying to eat things it doesn't make sense
to eat. For something eatable, check first whether you're holding it,
then whether you have a knife, then whether you're stuffed (gives
better message for "eat coconuts" when you don't have any). From
OpenBSD.
Use a lookup table to identify whether objects are plural or singular,
instead of testing the final character against 's' in each place.
Avoids oddities about "pot of jewels" and "compass".
Check for an object being taken not being there before checking for
whether it is too heavy or too bulky; gives a better message for "take
viper" with the viper not present.
Remove all adjectives in parse(), since they are nowhere used. Fixes
crash on "carry old all" shown up by fuzz testing. Patch from Paul
Janzen <pjanzen@foatdi.harvard.edu>.
Various improvements to parsing in battlestar, mostly from OpenBSD.
Define a constant WORDLEN. Always use this constant and NWORD where
appropriate.
Use NWORD - 1 in battlestar.c to avoid off-by-one error.
Increment wordnumber after the INVEN verb to allow it to be followed
by a comma and other actions.
Avoid overflowing elements of the words array if input words are too
long.
Parse "," as AND except when followed by a verb, to allow such
constructions as "take foo, bar, and baz". Trim AND AND which may
occur from the ", and" in such a list.
Avoid crashes from EVERYTHING in the wrong place by moving it to the
start of OBJECT AND EVERYTHING and NOUNS AND EVERYTHING sequences, and
trimming EVERYTHING AND EVERYTHING.
Don't try to wear anything that isn't OBJECT or NOUNS. Don't try to
wear DOOR or anything without a short description. Fixes crashes on
"wear knfo" (bug reported by Peter Maydell
<pmaydell@chiark.greenend.org.uk>), "wear wear", "wear kick", "wear
door" and "wear goddess". Partly from OpenBSD.
Patches from OpenBSD: add verbs "open"/"unlock" (essentially a no-op),
and "verbose"/"brief" (in verbose mode, always show long room
descriptions), and synonyms "papaya" for "papayas" and "coconut" for
"coconuts".
Make code clearer; add a macro ROOMDESC for the number of times a room
should be visited for the short description only to be used, and don't
increment beenthere[position] beyond this value. From OpenBSD.