-/* $NetBSD: com2.c,v 1.10 2000/09/17 23:04:17 jsm Exp $ */
+/* $NetBSD: com2.c,v 1.15 2000/09/23 19:23:57 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
#if 0
static char sccsid[] = "@(#)com2.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: com2.c,v 1.10 2000/09/17 23:04:17 jsm Exp $");
+__RCSID("$NetBSD: com2.c,v 1.15 2000/09/23 19:23:57 jsm Exp $");
#endif
#endif /* not lint */
int
wearit()
{ /* synonyms = {sheathe, sheath} */
- int n;
int firstnumber, value;
firstnumber = wordnumber;
- while (wordtype[++wordnumber] == ADJS);
- while (wordnumber <= wordcount) {
+ wordnumber++;
+ while (wordnumber <= wordcount && (wordtype[wordnumber] == OBJECT ||
+ wordtype[wordnumber] == NOUNS) && wordvalue[wordnumber] != DOOR) {
value = wordvalue[wordnumber];
- for (n = 0; objsht[value][n]; n++);
+ if (objsht[value] == NULL)
+ break;
switch (value) {
case -1:
return (firstnumber);
default:
- printf("You can't wear%s%s!\n", (objsht[value][n - 1] == 's' ? " " : " a "), objsht[value]);
+ printf("You can't wear%s%s!\n", (is_plural_object(value) ? " " : " a "), objsht[value]);
return (firstnumber);
case KNIFE:
encumber -= objcumber[value];
ourtime++;
printf("You are now wearing %s %s.\n",
- (objsht[value][n - 1] == 's' ? "the"
+ (is_plural_object(value) ? "the"
: "a"), objsht[value]);
} else
if (testbit(wear, value))
int
use()
{
- while (wordtype[++wordnumber] == ADJS && wordnumber < wordcount);
+ wordnumber++;
if (wordvalue[wordnumber] == AMULET && testbit(inven, AMULET) &&
position != FINAL) {
puts("The amulet begins to glow.");
int n;
for (n = 0; !((n == SWORD || n == KNIFE || n == TWO_HANDED || n == MACE || n == CLEAVER || n == BROAD || n == CHAIN || n == SHOVEL || n == HALBERD) && testbit(inven, n)) && n < NUMOFOBJECTS; n++);
- if (n == NUMOFOBJECTS)
- puts("You don't have suitable weapons to kill.");
- else {
+ if (n == NUMOFOBJECTS) {
+ if (testbit(inven, LASER)) {
+ printf("Your laser should do the trick.\n");
+ n = wordnumber + 1;
+ switch(wordvalue[n]) {
+ case NORMGOD:
+ case TIMER:
+ case NATIVE:
+ case MAN:
+ wordvalue[wordnumber] = SHOOT;
+ cypher();
+ break;
+ case -1:
+ puts("Kill what?");
+ break;
+ default:
+ if (wordtype[n] != OBJECT ||
+ wordvalue[wordnumber] == EVERYTHING)
+ puts("You can't kill that!");
+ else
+ printf("You can't kill the %s!\n",
+ objsht[wordvalue[n]]);
+ break;
+ }
+ } else
+ puts("You don't have suitable weapons to kill.");
+ } else {
printf("Your %s should do the trick.\n", objsht[n]);
- while (wordtype[++wordnumber] == ADJS);
+ wordnumber++;
switch (wordvalue[wordnumber]) {
case NORMGOD:
break;
default:
- if (wordtype[wordnumber] != OBJECT)
+ if (wordtype[wordnumber] != OBJECT ||
+ wordvalue[wordnumber] == EVERYTHING)
puts("You can't kill that!");
else
printf("You can't kill the %s!\n",