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".
This commit is contained in:
jsm 2000-09-17 23:03:43 +00:00
parent faf55ac40c
commit 31b523eee5
6 changed files with 85 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: com6.c,v 1.16 2000/09/10 10:51:17 jsm Exp $ */
/* $NetBSD: com6.c,v 1.17 2000/09/17 23:03:43 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)com6.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: com6.c,v 1.16 2000/09/10 10:51:17 jsm Exp $");
__RCSID("$NetBSD: com6.c,v 1.17 2000/09/17 23:03:43 jsm Exp $");
#endif
#endif /* not lint */
@ -248,3 +248,37 @@ light()
} else
puts("You're out of matches.");
}
void
dooropen()
{ /* synonyms = {open, unlock} */
while(wordtype[++wordnumber] == ADJS)
;
if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS
&& wordvalue[wordnumber] == DOOR) {
switch(position) {
case 189:
case 231:
if (location[189].north == 231)
puts("The door is already open.");
else
puts("The door does not budge.");
break;
case 30:
if (location[30].west == 25)
puts("The door is gone.");
else
puts("The door is locked tight.");
break;
case 31:
puts("That's one immovable door.");
break;
case 20:
puts("The door is already ajar.");
break;
default:
puts("What door?");
}
} else
puts("That doesn't open.");
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: cypher.c,v 1.13 2000/09/10 10:51:17 jsm Exp $ */
/* $NetBSD: cypher.c,v 1.14 2000/09/17 23:03:43 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)cypher.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: cypher.c,v 1.13 2000/09/10 10:51:17 jsm Exp $");
__RCSID("$NetBSD: cypher.c,v 1.14 2000/09/17 23:03:43 jsm Exp $");
#endif
#endif /* not lint */
@ -293,6 +293,23 @@ cypher()
lflag = use();
break;
case OPEN:
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
int things;
things = 0;
for (n = 0; n < NUMOFOBJECTS; n++)
if (testbit(inven, n)) {
things++;
wordvalue[wordnumber + 1] = n;
dooropen();
}
wordnumber += 2;
if (!things)
puts("Nothing to open!");
} else
dooropen();
break;
case LOOK:
if (!notes[CANTSEE] || testbit(inven, LAMPON) ||
testbit(location[position].objects, LAMPON)
@ -387,6 +404,16 @@ cypher()
free(rfilename);
break;
case VERBOSE:
verbose = 1;
printf("[Maximum verbosity]\n");
break;
case BRIEF:
verbose = 0;
printf("[Standard verbosity]\n");
break;
case FOLLOW:
lflag = follow();
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.19 2000/09/09 09:37:58 jsm Exp $ */
/* $NetBSD: extern.h,v 1.20 2000/09/17 23:03:43 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@ -187,6 +187,9 @@
#define BURY 1050
#define JUMP 1051
#define KICK 1052
#define OPEN 1053
#define VERBOSE 1054
#define BRIEF 1055
/* injuries */
#define ARM 6 /* broken arm */
@ -284,6 +287,7 @@ extern unsigned int inven[NUMOFWORDS];
extern unsigned int wear[NUMOFWORDS];
extern char beenthere[NUMOFROOMS + 1];
extern char injuries[NUMOFINJURIES];
extern int verbose;
extern const char *username;
@ -317,6 +321,7 @@ int cypher __P((void));
void die __P((void)) __attribute__((__noreturn__));
void diesig __P((int)) __attribute__((__noreturn__));
void dig __P((void));
void dooropen __P((void));
int draw __P((void));
void drink __P((void));
int drive __P((void));

View File

@ -1,4 +1,4 @@
/* $NetBSD: globals.c,v 1.11 2000/09/09 09:37:58 jsm Exp $ */
/* $NetBSD: globals.c,v 1.12 2000/09/17 23:03:43 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)globals.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: globals.c,v 1.11 2000/09/09 09:37:58 jsm Exp $");
__RCSID("$NetBSD: globals.c,v 1.12 2000/09/17 23:03:43 jsm Exp $");
#endif
#endif /* not lint */
@ -256,6 +256,7 @@ unsigned int inven[NUMOFWORDS];
unsigned int wear[NUMOFWORDS];
char beenthere[NUMOFROOMS + 1];
char injuries[NUMOFINJURIES];
int verbose = 0;
const char *username;

View File

@ -1,4 +1,4 @@
/* $NetBSD: room.c,v 1.9 2000/09/10 10:52:56 jsm Exp $ */
/* $NetBSD: room.c,v 1.10 2000/09/17 23:03:43 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)room.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: room.c,v 1.9 2000/09/10 10:52:56 jsm Exp $");
__RCSID("$NetBSD: room.c,v 1.10 2000/09/17 23:03:43 jsm Exp $");
#endif
#endif /* not lint */
@ -52,7 +52,7 @@ writedes()
int c;
printf("\n\t%s\n", location[position].name);
if (beenthere[position] < ROOMDESC) {
if (beenthere[position] < ROOMDESC || verbose) {
compass = NORTH;
for (p = location[position].desc; (c = *p++) != 0;)
if (c != '-' && c != '*' && c != '+') {

View File

@ -1,4 +1,4 @@
/* $NetBSD: words.c,v 1.7 2000/09/09 18:03:58 jsm Exp $ */
/* $NetBSD: words.c,v 1.8 2000/09/17 23:03:43 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)words.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: words.c,v 1.7 2000/09/09 18:03:58 jsm Exp $");
__RCSID("$NetBSD: words.c,v 1.8 2000/09/17 23:03:43 jsm Exp $");
#endif
#endif /* not lint */
@ -91,9 +91,11 @@ struct wlist wlist[] = {
{ "match", MATCHES, OBJECT, NULL },
{ "book", MATCHES, OBJECT, NULL },
{ "man", MAN, NOUNS, NULL },
{ "papaya", PAPAYAS, OBJECT, NULL },
{ "papayas", PAPAYAS, OBJECT, NULL },
{ "pineapple", PINEAPPLE, OBJECT, NULL },
{ "kiwi", KIWI, OBJECT, NULL },
{ "coconut", COCONUTS, OBJECT, NULL },
{ "coconuts", COCONUTS, OBJECT, NULL },
{ "mango", MANGO, OBJECT, NULL },
{ "ring", RING, OBJECT, NULL },
@ -173,6 +175,8 @@ struct wlist wlist[] = {
{ "hack", SMITE, VERB, NULL },
{ "shoot", SHOOT, VERB, NULL },
{ "blast", SHOOT, VERB, NULL },
{ "open", OPEN, VERB, NULL },
{ "unlock", OPEN, VERB, NULL },
{ "on", ON, PREPS, NULL },
{ "off", OFF, PREPS, NULL },
{ "time", TIME, VERB, NULL },
@ -182,6 +186,8 @@ struct wlist wlist[] = {
{ "swim", SWIM, VERB, NULL },
{ "drink", DRINK, VERB, NULL },
{ "door", DOOR, NOUNS, NULL },
{ "verbose", VERBOSE, VERB, NULL },
{ "brief", BRIEF, VERB, NULL },
{ "save", SAVE, VERB, NULL },
{ "ride", RIDE, VERB, NULL },
{ "mount", RIDE, VERB, NULL },