summaryrefslogtreecommitdiffstats
path: root/battlestar/extern.h
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>2000-09-21 17:44:34 +0000
committerjsm <jsm@NetBSD.org>2000-09-21 17:44:34 +0000
commit0ba05dd5a679e7723ea4b9f1426175b1651926cf (patch)
tree8beede32304395cb7418af5573f1e3b042030ca8 /battlestar/extern.h
parent66bc28438e19fafc7abecfa76bce72d10174c9be (diff)
downloadbsdgames-darwin-0ba05dd5a679e7723ea4b9f1426175b1651926cf.tar.gz
bsdgames-darwin-0ba05dd5a679e7723ea4b9f1426175b1651926cf.tar.zst
bsdgames-darwin-0ba05dd5a679e7723ea4b9f1426175b1651926cf.zip
Various improvements to parsing in battlestar, mostly from OpenBSD.
Define a constant WORDLEN. Always use this constant and NWORD where appropriate. Use NWORD - 1 in battlestar.c to avoid off-by-one error. Increment wordnumber after the INVEN verb to allow it to be followed by a comma and other actions. Avoid overflowing elements of the words array if input words are too long. Parse "," as AND except when followed by a verb, to allow such constructions as "take foo, bar, and baz". Trim AND AND which may occur from the ", and" in such a list. Avoid crashes from EVERYTHING in the wrong place by moving it to the start of OBJECT AND EVERYTHING and NOUNS AND EVERYTHING sequences, and trimming EVERYTHING AND EVERYTHING.
Diffstat (limited to 'battlestar/extern.h')
-rw-r--r--battlestar/extern.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/battlestar/extern.h b/battlestar/extern.h
index efd6366c..81ffa9c3 100644
--- a/battlestar/extern.h
+++ b/battlestar/extern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.20 2000/09/17 23:03:43 jsm Exp $ */
+/* $NetBSD: extern.h,v 1.21 2000/09/21 17:44:34 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -253,8 +253,9 @@ extern const int objwt[NUMOFOBJECTS];
extern const int objcumber[NUMOFOBJECTS];
/* current input line */
+#define WORDLEN 15
#define NWORD 20 /* words per line */
-extern char words[NWORD][15];
+extern char words[NWORD][WORDLEN];
extern int wordvalue[NWORD];
extern int wordtype[NWORD];
extern int wordcount, wordnumber;