summaryrefslogtreecommitdiffstats
path: root/battlestar
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>2000-09-24 09:46:03 +0000
committerjsm <jsm@NetBSD.org>2000-09-24 09:46:03 +0000
commit3d4902aa7de8b16683432881769e634609db5457 (patch)
tree55b8bdeb6326f087ac3924f2eea9d0446c2f176d /battlestar
parent02ca4f595197389c9734b95624d982e9540e57b1 (diff)
downloadbsdgames-darwin-3d4902aa7de8b16683432881769e634609db5457.tar.gz
bsdgames-darwin-3d4902aa7de8b16683432881769e634609db5457.tar.zst
bsdgames-darwin-3d4902aa7de8b16683432881769e634609db5457.zip
Give a better message for trying to eat things it doesn't make sense
to eat. For something eatable, check first whether you're holding it, then whether you have a knife, then whether you're stuffed (gives better message for "eat coconuts" when you don't have any). From OpenBSD.
Diffstat (limited to 'battlestar')
-rw-r--r--battlestar/com4.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/battlestar/com4.c b/battlestar/com4.c
index fde7872f..e4b1e078 100644
--- a/battlestar/com4.c
+++ b/battlestar/com4.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com4.c,v 1.15 2000/09/24 09:39:56 jsm Exp $ */
+/* $NetBSD: com4.c,v 1.16 2000/09/24 09:46:03 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.15 2000/09/24 09:39:56 jsm Exp $");
+__RCSID("$NetBSD: com4.c,v 1.16 2000/09/24 09:46:03 jsm Exp $");
#endif
#endif /* not lint */
@@ -371,10 +371,14 @@ eat()
wordnumber++;
while (wordnumber <= wordcount) {
value = wordvalue[wordnumber];
- if (wordtype[wordnumber] != OBJECT)
- value = -1;
+ if (wordtype[wordnumber] != OBJECT || objsht[value] == NULL)
+ value = -2;
switch (value) {
+ case -2:
+ puts("You can't eat that!");
+ return (firstnumber);
+
case -1:
puts("Eat what?");
return (firstnumber);
@@ -402,12 +406,12 @@ eat()
snooze += CYCLE / 10;
ourtime++;
puts("Eaten. You can explore a little longer now.");
- } else if (ourtime < ate - CYCLE)
- puts("You're stuffed.");
+ } else if (!testbit(inven, value))
+ printf("You aren't holding the %s.\n", objsht[value]);
else if (!testbit(inven, KNIFE))
puts("You need a knife.");
else
- printf("You aren't holding the %s.\n", objsht[value]);
+ puts("You're stuffed.");
if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
wordnumber++;
else