From 3d4902aa7de8b16683432881769e634609db5457 Mon Sep 17 00:00:00 2001 From: jsm Date: Sun, 24 Sep 2000 09:46:03 +0000 Subject: 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. --- battlestar/com4.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'battlestar/com4.c') 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 -- cgit v1.2.3-56-ge451