Commit Graph

76 Commits

Author SHA1 Message Date
jsm 05ca74ab1c Don't say "Kicked." of an object not present; give sensible messages.
From OpenBSD.
2000-09-22 12:38:10 +00:00
jsm 016903dbdb 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.
2000-09-22 12:37:32 +00:00
jsm d67a03db02 Give appropriate messages (rather than saying nothing) if an verb is
used with "all" and nothing relevant is present.  From OpenBSD.
2000-09-22 08:19:57 +00:00
jsm 0f933d0d56 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>.
2000-09-22 08:19:21 +00:00
jsm b283f74760 Give an appropriate error on "kill all" rather than a crash or
nonsense message.  From OpenBSD.
2000-09-22 08:18:20 +00:00
jsm 1fc5d09e80 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.
2000-09-21 17:44:34 +00:00
jsm 6d1847f667 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.
2000-09-21 10:38:50 +00:00
jsm a4454d2982 If no hand-to-hand weapons are available, try using the laser to kill
in murder().  From OpenBSD.
2000-09-21 10:22:36 +00:00
jsm 16d8e9af6f die() on EOF; based on OpenBSD. 2000-09-21 09:49:03 +00:00
jsm 956f5c6ba6 From OpenBSD: in kiss(), "take" the bathing goddess if required, and
give a better error message if the person to kiss is not present.
2000-09-21 09:48:10 +00:00
jsm ca5dbcecd4 Add missing initialisers (avoid gcc -W warnings) and comments giving
room numbers.
2000-09-18 06:14:31 +00:00
jsm 819ea9d1a6 Clean up formatting; partly from OpenBSD. 2000-09-17 23:04:17 +00:00
jsm 31b523eee5 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".
2000-09-17 23:03:43 +00:00
jsm cf35dbffa1 Based on OpenBSD: spelling, punctuation, grammar and line length
adjustments, and support for '=' in room descriptions meaning a
literal '-'.
2000-09-10 10:52:56 +00:00
jsm 3e02203ec6 Wording, punctuation and line length improvements. Also adjust test
for killing nonsensical things to fix crash with "kill door".  From
OpenBSD.
2000-09-10 10:51:16 +00:00
jsm d71839604a Make spacing nicer and add explicit NULL initializers. 2000-09-09 18:03:58 +00:00
jsm c6bbb5288d Store copy of username with strdup rather than using a fixed length
buffer.  Also make initialization functions and arrays static.
2000-09-09 09:37:58 +00:00
jsm ce85e35a32 Put prototypes in alphabetical order. 2000-09-09 09:36:23 +00:00
jsm a7c82eea02 Spelling and punctuation corrections or improvements from OpenBSD. 2000-09-08 17:25:31 +00:00
jsm af3dee978f 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.
2000-09-08 17:22:01 +00:00
jsm ec240586d1 Manpage improvements based on OpenBSD. 2000-09-08 17:18:36 +00:00
mycroft 15b7289f72 Rename move() to moveplayer() to avoid clashing with libcurses. 2000-07-23 23:57:23 +00:00
mycroft f9eca6973d Use setgid(), not setregid(). 2000-05-08 07:55:59 +00:00
jsm a5da40c55a Use err(1, NULL) and warn(NULL) for `out of memory' error messages. 2000-01-09 17:17:19 +00:00
jsm 20e3305006 Fix -Wsign-compare warnings. 1999-09-18 19:38:46 +00:00
jsm 2dae19bfbc Use strncpy() rather than strcpy() with fixed size buffer. 1999-09-18 16:47:11 +00:00
jsm e4df5a936a Add missing initialisers. 1999-09-18 16:42:29 +00:00
jsm c15fcd0e23 Add FALLTHROUGH comment. 1999-09-18 16:41:38 +00:00
jsm 57b9dc499c Give sensible error message in a shouldn't happen case. 1999-09-18 16:40:04 +00:00
jsm 5e8cc984ee Declare variables in extern.h as extern, and add non-extern
declarations to globals.c.
1999-09-14 19:54:47 +00:00
jsm 5b8f738447 Use time() instead of gettimeofday(). 1999-09-14 18:08:46 +00:00
jsm a1038d000e Fix uses of names of library functions for other purposes. 1999-09-13 17:18:56 +00:00
jsm 7dc5308d13 A couple more checks for file descriptor < 3 missed earlier. 1999-09-13 17:15:42 +00:00
jsm b03d4fa882 Add `__noreturn__' and `__unused__' attributes where appropriate to
the games.

This merges in all such remaining changes from the Linux port of the
NetBSD games, except in hunt (where substantial changes from OpenBSD
need to be looked at).

Most noreturn attributes were previously added in bin/6144, with some
others that were missed then in bin/8082.  Previous `unused'
attributes were covered in bin/6557, bin/8058 and other PRs (all these
PRs have already been handled and closed).
1999-09-08 21:45:25 +00:00
hubertf 6c243d931c This patch improves the handling of save files in battlestar(6), by
allowing the user to choose the name of the save file and specify it
on the command line when restoring.  It also eliminates a buffer
overrun in determining the path to the save file, and any particular
arbitrary limit on the name length.  In the name of a tidier home
directory, the default name is changed from "Bstar" to ".Bstar".

Patch supplied in PR 8085 by Joseph Myers <jsm28@cam.ac.uk>
Minor modification (s/startup/filename/ in initialize()) by me.
1999-07-28 01:45:41 +00:00
hubertf 054e79fedd Drop setgid privileges early. Derived from OpenBSD and sent in as PR 5970
by Joseph Myers <jsm28@cam.ac.uk>.
1999-07-21 03:56:53 +00:00
hubertf 12a0758a42 From PR 7987 by Joseph Myers <jsm28@cam.ac.uk>:
More battlestar(6) spelling and punctuation fixes for battlestar(6).
These ones come from OpenBSD.
1999-07-14 17:42:13 +00:00
simonb a2ed16d0dd initscr() returns a pointer, compare return value with NULL and not
an int.
Compatible with other versions of curses.
1999-04-18 03:30:12 +00:00
hubertf dab3a74af9 Fix object recognition, per PR 6048 by Joseph S. Myers <jsm28@cam.ac.uk>. 1999-03-25 16:46:08 +00:00
hubertf bd8be7848a Const poisoning, per PR 6660 by Joseph Myers <jsm28@cam.ac.uk> 1999-02-10 01:36:50 +00:00
hubertf 1c9494f62b mark non-returning functions (PR#6144 by Joseph Myers <jsm28@cam.ac.uk>) 1998-09-13 15:27:25 +00:00
hubertf ade2d3629c add sanity checks when saving/restoring games (PR#6138 by Joseph Myers <jsm28@cam.ac.uk>) 1998-09-13 15:24:41 +00:00
frueauf e5512611f3 Fix typo, closes pr 6137 by Joseph Myers. 1998-09-10 21:50:35 +00:00
veego 04afeca685 Add braces to make the new egcs happy. 1998-08-30 09:19:36 +00:00
hubertf e16198b7d4 DTRT if "give" is invoked without arguments. Fix contributed by Joseph S.
Myers <jsm28@cam.ac.uk>, closeds PR 6049.
1998-08-29 19:58:12 +00:00
hubertf 62afb47308 Don't allow empty "give" command (without arguments).
Fixes PR 6049 by Joseph Myers <jsm@octomino.demon.co.uk>.
1998-08-28 00:44:31 +00:00
hubertf 13091fe5b7 Untakable objects are marked with NULL pointers, not empty strings,
resulting in core dumps. Fixed as per PR 6006 by Joseph Myers
<jsm28@cam.ac.uk>.
1998-08-24 00:25:32 +00:00
hubertf 2f4d86d39f Propperly note place-change, as reported in PR 6008 by Joseph Samuel Myers
<jsm28@cam.ac.uk>
1998-08-24 00:22:45 +00:00
hubertf 99c239447e Initialize return-value correctly as pointed out in PR 6007 by
Joseph Myers <jsm@octomino.demon.co.uk>.
1998-08-24 00:19:25 +00:00
hubertf f62b88952a Fix some spelling errors reported by Joseph Myers <jsm28@cam.ac.uk>
in PR 5842.
1998-07-25 10:58:03 +00:00