Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/games/battlestar Patches from OpenBSD: add verbs "open"/"unl...
details: https://anonhg.NetBSD.org/src/rev/46e76ddeb555
branches: trunk
changeset: 497060:46e76ddeb555
user: jsm <jsm%NetBSD.org@localhost>
date: Sun Sep 17 23:03:43 2000 +0000
description:
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".
diffstat:
games/battlestar/com6.c | 38 ++++++++++++++++++++++++++++++++++++--
games/battlestar/cypher.c | 31 +++++++++++++++++++++++++++++--
games/battlestar/extern.h | 7 ++++++-
games/battlestar/globals.c | 5 +++--
games/battlestar/room.c | 6 +++---
games/battlestar/words.c | 10 ++++++++--
6 files changed, 85 insertions(+), 12 deletions(-)
diffs (251 lines):
diff -r b25223c9460c -r 46e76ddeb555 games/battlestar/com6.c
--- a/games/battlestar/com6.c Sun Sep 17 22:07:39 2000 +0000
+++ b/games/battlestar/com6.c Sun Sep 17 23:03:43 2000 +0000
@@ -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 @@
} 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.");
+}
diff -r b25223c9460c -r 46e76ddeb555 games/battlestar/cypher.c
--- a/games/battlestar/cypher.c Sun Sep 17 22:07:39 2000 +0000
+++ b/games/battlestar/cypher.c Sun Sep 17 23:03:43 2000 +0000
@@ -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 @@
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 @@
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;
diff -r b25223c9460c -r 46e76ddeb555 games/battlestar/extern.h
--- a/games/battlestar/extern.h Sun Sep 17 22:07:39 2000 +0000
+++ b/games/battlestar/extern.h Sun Sep 17 23:03:43 2000 +0000
@@ -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 wear[NUMOFWORDS];
extern char beenthere[NUMOFROOMS + 1];
extern char injuries[NUMOFINJURIES];
+extern int verbose;
extern const char *username;
@@ -317,6 +321,7 @@
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));
diff -r b25223c9460c -r 46e76ddeb555 games/battlestar/globals.c
--- a/games/battlestar/globals.c Sun Sep 17 22:07:39 2000 +0000
+++ b/games/battlestar/globals.c Sun Sep 17 23:03:43 2000 +0000
@@ -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 wear[NUMOFWORDS];
char beenthere[NUMOFROOMS + 1];
char injuries[NUMOFINJURIES];
+int verbose = 0;
const char *username;
diff -r b25223c9460c -r 46e76ddeb555 games/battlestar/room.c
--- a/games/battlestar/room.c Sun Sep 17 22:07:39 2000 +0000
+++ b/games/battlestar/room.c Sun Sep 17 23:03:43 2000 +0000
@@ -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 @@
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 != '+') {
diff -r b25223c9460c -r 46e76ddeb555 games/battlestar/words.c
--- a/games/battlestar/words.c Sun Sep 17 22:07:39 2000 +0000
+++ b/games/battlestar/words.c Sun Sep 17 23:03:43 2000 +0000
@@ -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 @@
{ "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 @@
{ "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 @@
{ "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 },
Home |
Main Index |
Thread Index |
Old Index