summaryrefslogtreecommitdiffstats
path: root/battlestar
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>2000-09-24 09:39:56 +0000
committerjsm <jsm@NetBSD.org>2000-09-24 09:39:56 +0000
commitf55810a947cd7ac1e0a30fc324fd8dd7794aadf8 (patch)
treea855b053aae490512b0554555fdc0061c5cfa157 /battlestar
parent22b1e448744a145c47dcf7ca7d00bcc0ecbeeba3 (diff)
downloadbsdgames-darwin-f55810a947cd7ac1e0a30fc324fd8dd7794aadf8.tar.gz
bsdgames-darwin-f55810a947cd7ac1e0a30fc324fd8dd7794aadf8.tar.zst
bsdgames-darwin-f55810a947cd7ac1e0a30fc324fd8dd7794aadf8.zip
Attempt to disambiguate BODY for kicking. Avoid crashing or nonsense
messages on "kick door" and "kick man". From OpenBSD.
Diffstat (limited to 'battlestar')
-rw-r--r--battlestar/com4.c85
1 files changed, 55 insertions, 30 deletions
diff --git a/battlestar/com4.c b/battlestar/com4.c
index 72442cb4..fde7872f 100644
--- a/battlestar/com4.c
+++ b/battlestar/com4.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com4.c,v 1.14 2000/09/23 19:23:58 jsm Exp $ */
+/* $NetBSD: com4.c,v 1.15 2000/09/24 09:39:56 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)com4.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: com4.c,v 1.14 2000/09/23 19:23:58 jsm Exp $");
+__RCSID("$NetBSD: com4.c,v 1.15 2000/09/24 09:39:56 jsm Exp $");
#endif
#endif /* not lint */
@@ -280,39 +280,64 @@ drop(name)
wordnumber++;
while (wordnumber <= wordcount && (wordtype[wordnumber] == OBJECT || wordtype[wordnumber] == NOUNS)) {
value = wordvalue[wordnumber];
- printf("%s:\n", objsht[value]);
- if (testbit(inven, value)) {
- clearbit(inven, value);
- carrying -= objwt[value];
- encumber -= objcumber[value];
- if (value == BOMB) {
- puts("The bomb explodes. A blinding white light and immense concussion obliterate us.");
- die();
- }
- if (value != AMULET && value != MEDALION && value != TALISMAN)
- setbit(location[position].objects, value);
+ if (value == BODY) { /* special case */
+ wordtype[wordnumber] = OBJECT;
+ if (testbit(inven, MAID) || testbit(location[position].objects, MAID))
+ value = MAID;
+ else if (testbit(inven, DEADWOOD) || testbit(location[position].objects, DEADWOOD))
+ value = DEADWOOD;
+ else if (testbit(inven, DEADGOD) || testbit(location[position].objects, DEADGOD))
+ value = DEADGOD;
+ else if (testbit(inven, DEADTIME) || testbit(location[position].objects, DEADTIME))
+ value = DEADTIME;
+ else if (testbit(inven, DEADNATIVE) || testbit(location[position].objects, DEADNATIVE))
+ value = DEADNATIVE;
+ }
+ if (wordtype[wordnumber] == NOUNS && value == DOOR) {
+ if (*name == 'K')
+ puts("You hurt your foot.");
else
- tempwiz = 0;
- ourtime++;
+ puts("You're not holding a door.");
+ } else if (objsht[value] == NULL) {
if (*name == 'K')
- puts("Drop kicked.");
+ puts("That's not for kicking!");
else
- printf("%s.\n", name);
+ puts("You don't have that.");
} else {
- if (*name != 'K') {
- printf("You aren't holding the %s.\n", objsht[value]);
- if (testbit(location[position].objects, value)) {
- if (*name == 'T')
- puts("Kicked instead.");
- else if (*name == 'G')
- puts("Given anyway.");
+ printf("%s:\n", objsht[value]);
+ if (testbit(inven, value)) {
+ clearbit(inven, value);
+ carrying -= objwt[value];
+ encumber -= objcumber[value];
+ if (value == BOMB) {
+ puts("The bomb explodes. A blinding white light and immense concussion obliterate us.");
+ die();
}
- } else if (testbit(location[position].objects, value))
- puts("Kicked.");
- else if (testbit(wear, value))
- puts("Not while it's being worn.");
- else
- puts("Not found.");
+ if (value != AMULET && value != MEDALION && value != TALISMAN)
+ setbit(location[position].objects, value);
+ else
+ tempwiz = 0;
+ ourtime++;
+ if (*name == 'K')
+ puts("Drop kicked.");
+ else
+ printf("%s.\n", name);
+ } else {
+ if (*name != 'K') {
+ printf("You aren't holding the %s.\n", objsht[value]);
+ if (testbit(location[position].objects, value)) {
+ if (*name == 'T')
+ puts("Kicked instead.");
+ else if (*name == 'G')
+ puts("Given anyway.");
+ }
+ } else if (testbit(location[position].objects, value))
+ puts("Kicked.");
+ else if (testbit(wear, value))
+ puts("Not while it's being worn.");
+ else
+ puts("Not found.");
+ }
}
if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
wordnumber++;