externs.h -> extern.h
[unix-history] / usr / src / games / battlestar / battlestar.c
CommitLineData
fdc7d56f 1/*
86164080
KB
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
e95fc82a 4 *
a6547b1d 5 * %sccs.include.redist.c%
fdc7d56f
EW
6 */
7
1b678f72 8#ifndef lint
86164080
KB
9static char copyright[] =
10"@(#) Copyright (c) 1983, 1993\n\
11 The Regents of the University of California. All rights reserved.\n";
e95fc82a
KB
12#endif /* not lint */
13
14#ifndef lint
3f96a52e 15static char sccsid[] = "@(#)battlestar.c 8.2 (Berkeley) %G%";
e95fc82a 16#endif /* not lint */
1b678f72 17
fdc7d56f
EW
18/*
19 * Battlestar - a stellar-tropical adventure game
20 *
21 * Originally written by His Lordship, Admiral David W. Horatio Riggle,
22 * on the Cory PDP-11/70, University of California, Berkeley.
23 */
24
3f96a52e 25#include "extern.h"
1b678f72
EW
26
27main(argc,argv)
28int argc;
29char **argv;
30{
31 char mainbuf[LINELENGTH];
32 char *next;
33
34 initialize(argc < 2 || strcmp(argv[1], "-r"));
35start:
36 news();
a7c71d1e 37 beenthere[position]++;
1b678f72
EW
38 if (notes[LAUNCHED])
39 crash(); /* decrements fuel & crash */
40 if (matchlight) {
41 puts("Your match splutters out.");
42 matchlight = 0;
43 }
44 if (!notes[CANTSEE] || testbit(inven,LAMPON) ||
45 testbit(location[position].objects, LAMPON)) {
46 writedes();
47 printobjs();
48 } else
49 puts("It's too dark to see anything in here!");
50 whichway(location[position]);
51run:
52 next = getcom(mainbuf, sizeof mainbuf, ">-: ",
53 "Please type in something.");
54 for (wordcount = 0; next && wordcount < 20; wordcount++)
55 next = getword(next, words[wordcount], -1);
56 parse();
57 switch (cypher()) {
58 case -1:
59 goto run;
60 case 0:
61 goto start;
62 default:
63 exit();
64 }
65}