summaryrefslogtreecommitdiff
path: root/games/battlestar/com5.c
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>2000-09-26 04:42:57 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>2000-09-26 04:42:57 +0000
commit081be079b82a2b9dcf1d7c705032e009184290b4 (patch)
tree7ec64cfd94c4f374f423a2d1639f6ed60b6ea28a /games/battlestar/com5.c
parent1b52f89e205c620c377b41287725ba817dcd34bb (diff)
Improve handling of multiple commands on one line. Tidy fight parser.
Handle "all" in one place (almost). Add AUXVERB category and OBJ_PERSON/ OBJ_NONOBJ flags. Most was discussed with jsm@netbsd.org, and some is from him.
Diffstat (limited to 'games/battlestar/com5.c')
-rw-r--r--games/battlestar/com5.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/games/battlestar/com5.c b/games/battlestar/com5.c
index 09d758e9b0c..198320a9b8d 100644
--- a/games/battlestar/com5.c
+++ b/games/battlestar/com5.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com5.c,v 1.8 2000/09/24 21:55:23 pjanzen Exp $ */
+/* $OpenBSD: com5.c,v 1.9 2000/09/26 04:42:55 pjanzen Exp $ */
/* $NetBSD: com5.c,v 1.3 1995/03/21 15:07:07 cgd Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)com5.c 8.2 (Berkeley) 4/28/95";
#else
-static char rcsid[] = "$OpenBSD: com5.c,v 1.8 2000/09/24 21:55:23 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: com5.c,v 1.9 2000/09/26 04:42:55 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -47,8 +47,8 @@ static char rcsid[] = "$OpenBSD: com5.c,v 1.8 2000/09/24 21:55:23 pjanzen Exp $"
void
kiss()
{
- while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount)
- ;
+ if (inc_wordnumber(words[wordnumber], "whom"))
+ return;
/* The goddess must be "taken" first if bathing. */
if (wordtype[wordnumber] == NOUNS && wordvalue[wordnumber] == NORMGOD
&& TestBit(location[position].objects, BATHGOD)) {
@@ -93,6 +93,7 @@ kiss()
puts("I see nothing like that here.");
} else
puts("I'd prefer not to.");
+ wordnumber++;
}
void
@@ -100,12 +101,13 @@ love()
{
int n;
- while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount)
- ;
+ if (inc_wordnumber(words[wordnumber], "whom"))
+ return;
if (wordtype[wordnumber] == NOUNS) {
if ((TestBit(location[position].objects, BATHGOD) ||
TestBit(location[position].objects, NORMGOD)) &&
wordvalue[wordnumber] == NORMGOD) {
+ wordnumber++;
if (loved) {
printf("Loved.\n");
return;
@@ -157,6 +159,7 @@ love()
puts("Where's your lover?");
} else
puts("It doesn't seem to work.");
+ wordnumber++;
}
int
@@ -275,7 +278,11 @@ give()
last1 = last2 = wordcount + 2;
firstnumber = wordnumber;
- while (wordtype[++wordnumber] != OBJECT && wordvalue[wordnumber] != AMULET && wordvalue[wordnumber] != MEDALION && wordvalue[wordnumber] != TALISMAN && wordnumber <= wordcount)
+ while (wordtype[++wordnumber] != OBJECT &&
+ wordvalue[wordnumber] != AMULET &&
+ wordvalue[wordnumber] != MEDALION &&
+ wordvalue[wordnumber] != TALISMAN &&
+ wordnumber <= wordcount)
;
if (wordnumber <= wordcount) {
obj = wordvalue[wordnumber];