diff --git a/games/battlestar/com2.c b/games/battlestar/com2.c index 0de73532d9a1..ec0e45922ee2 100644 --- a/games/battlestar/com2.c +++ b/games/battlestar/com2.c @@ -1,4 +1,4 @@ -/* $NetBSD: com2.c,v 1.13 2000/09/22 08:18:20 jsm Exp $ */ +/* $NetBSD: com2.c,v 1.14 2000/09/22 08:19:21 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)com2.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: com2.c,v 1.13 2000/09/22 08:18:20 jsm Exp $"); +__RCSID("$NetBSD: com2.c,v 1.14 2000/09/22 08:19:21 jsm Exp $"); #endif #endif /* not lint */ @@ -51,7 +51,7 @@ wearit() int firstnumber, value; firstnumber = wordnumber; - while (wordtype[++wordnumber] == ADJS); + wordnumber++; while (wordnumber <= wordcount && (wordtype[wordnumber] == OBJECT || wordtype[wordnumber] == NOUNS) && wordvalue[wordnumber] != DOOR) { value = wordvalue[wordnumber]; @@ -139,7 +139,7 @@ draw() int use() { - while (wordtype[++wordnumber] == ADJS && wordnumber < wordcount); + wordnumber++; if (wordvalue[wordnumber] == AMULET && testbit(inven, AMULET) && position != FINAL) { puts("The amulet begins to glow."); @@ -184,9 +184,7 @@ murder() if (n == NUMOFOBJECTS) { if (testbit(inven, LASER)) { printf("Your laser should do the trick.\n"); - n = wordnumber; - while (wordtype[++n] == ADJS) - ; + n = wordnumber + 1; switch(wordvalue[n]) { case NORMGOD: case TIMER: @@ -211,7 +209,7 @@ murder() 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: diff --git a/games/battlestar/com3.c b/games/battlestar/com3.c index 774239a5d18a..86b2e9c1cd12 100644 --- a/games/battlestar/com3.c +++ b/games/battlestar/com3.c @@ -1,4 +1,4 @@ -/* $NetBSD: com3.c,v 1.8 2000/09/10 10:51:17 jsm Exp $ */ +/* $NetBSD: com3.c,v 1.9 2000/09/22 08:19:21 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)com3.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: com3.c,v 1.8 2000/09/10 10:51:17 jsm Exp $"); +__RCSID("$NetBSD: com3.c,v 1.9 2000/09/22 08:19:21 jsm Exp $"); #endif #endif /* not lint */ @@ -200,7 +200,7 @@ shoot() if (!testbit(inven, LASER)) puts("You aren't holding a blaster."); else { - while (wordtype[++wordnumber] == ADJS); + wordnumber++; while (wordnumber <= wordcount && wordtype[wordnumber] == OBJECT) { value = wordvalue[wordnumber]; printf("%s:\n", objsht[value]); diff --git a/games/battlestar/com4.c b/games/battlestar/com4.c index d1be836d46e3..1f37eae320b1 100644 --- a/games/battlestar/com4.c +++ b/games/battlestar/com4.c @@ -1,4 +1,4 @@ -/* $NetBSD: com4.c,v 1.10 2000/09/17 23:04:17 jsm Exp $ */ +/* $NetBSD: com4.c,v 1.11 2000/09/22 08:19:21 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.10 2000/09/17 23:04:17 jsm Exp $"); +__RCSID("$NetBSD: com4.c,v 1.11 2000/09/22 08:19:21 jsm Exp $"); #endif #endif /* not lint */ @@ -57,7 +57,7 @@ take(from) wordvalue[wordnumber] = TAKEOFF; return (cypher()); } else { - while (wordtype[++wordnumber] == ADJS); + wordnumber++; while (wordnumber <= wordcount && wordtype[wordnumber] == OBJECT) { value = wordvalue[wordnumber]; printf("%s:\n", objsht[value]); @@ -222,8 +222,7 @@ throw(name) deposit = location[position].down; break; } - wordnumber = first; - while (wordtype[++wordnumber] == ADJS); + wordnumber = first + 1; while (wordnumber <= wordcount) { value = wordvalue[wordnumber]; if (deposit && testbit(location[position].objects, value)) { @@ -275,7 +274,7 @@ drop(name) int firstnumber, value; firstnumber = wordnumber; - while (wordtype[++wordnumber] == ADJS); + wordnumber++; while (wordnumber <= wordcount && (wordtype[wordnumber] == OBJECT || wordtype[wordnumber] == NOUNS)) { value = wordvalue[wordnumber]; printf("%s:\n", objsht[value]); @@ -337,7 +336,7 @@ eat() int firstnumber, value; firstnumber = wordnumber; - while (wordtype[++wordnumber] == ADJS); + wordnumber++; while (wordnumber <= wordcount) { value = wordvalue[wordnumber]; switch (value) { diff --git a/games/battlestar/com6.c b/games/battlestar/com6.c index 3dbe88239c3c..5009293be3b5 100644 --- a/games/battlestar/com6.c +++ b/games/battlestar/com6.c @@ -1,4 +1,4 @@ -/* $NetBSD: com6.c,v 1.18 2000/09/17 23:04:17 jsm Exp $ */ +/* $NetBSD: com6.c,v 1.19 2000/09/22 08:19:21 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)com6.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: com6.c,v 1.18 2000/09/17 23:04:17 jsm Exp $"); +__RCSID("$NetBSD: com6.c,v 1.19 2000/09/22 08:19:21 jsm Exp $"); #endif #endif /* not lint */ @@ -242,8 +242,7 @@ light() void dooropen() { /* synonyms = {open, unlock} */ - while(wordtype[++wordnumber] == ADJS) - ; + wordnumber++; if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS && wordvalue[wordnumber] == DOOR) { switch(position) { diff --git a/games/battlestar/cypher.c b/games/battlestar/cypher.c index 0f6c92cc0dc4..71cb11d71900 100644 --- a/games/battlestar/cypher.c +++ b/games/battlestar/cypher.c @@ -1,4 +1,4 @@ -/* $NetBSD: cypher.c,v 1.15 2000/09/21 17:44:34 jsm Exp $ */ +/* $NetBSD: cypher.c,v 1.16 2000/09/22 08:19:21 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)cypher.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: cypher.c,v 1.15 2000/09/21 17:44:34 jsm Exp $"); +__RCSID("$NetBSD: cypher.c,v 1.16 2000/09/22 08:19:21 jsm Exp $"); #endif #endif /* not lint */ @@ -54,8 +54,6 @@ cypher() char *filename, *rfilename; size_t filename_len; - while (wordtype[wordnumber] == ADJS) - wordnumber++; while (wordnumber <= wordcount) { switch (wordvalue[wordnumber]) { diff --git a/games/battlestar/parse.c b/games/battlestar/parse.c index e79722baba79..46a51a0bed33 100644 --- a/games/battlestar/parse.c +++ b/games/battlestar/parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.8 2000/09/21 17:44:34 jsm Exp $ */ +/* $NetBSD: parse.c,v 1.9 2000/09/22 08:19:21 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)parse.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: parse.c,v 1.8 2000/09/21 17:44:34 jsm Exp $"); +__RCSID("$NetBSD: parse.c,v 1.9 2000/09/22 08:19:21 jsm Exp $"); #endif #endif /* not lint */ @@ -110,6 +110,17 @@ parse() wordtype[n] = wp->article; } } + /* We never use adjectives for anything, so yank them all. */ + for (n = 1; n < wordcount; n++) + if (wordtype[n] == ADJS) { + int i; + for (i = n + 1; i < wordcount; i++) { + wordtype[i - 1] = wordtype[i]; + wordvalue[i - 1] = wordvalue[i]; + strcpy(words[i - 1], words[i]); + } + wordcount--; + } /* Don't let a comma mean AND if followed by a verb. */ for (n = 0; n < wordcount; n++) if (wordvalue[n] == AND && words[n][0] == ','