* Copyright (c) 1991 The Regents of the University of California.
* The game adventure was original written Fortran by Will Crowther
* and Don Woods. It was later translated to C and enhanced by
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)init.c 5.1 (Berkeley) %G%";
/* Re-coding of advent in C: data initialization */
int setbit
[16] = {1,2,4,010,020,040,0100,0200,0400,01000,02000,04000,
010000,020000,040000,0100000};
init(command
) /* everything for 1st time run */
char *command
; /* command we were called with */
rdata(); /* read data from orig. file */
setup
=1; /* indicate that data is in */
if (save(command
, "adventure") < 0) {
fprintf(stderr
, "adventure: save failed\n");
adfd
=open("adventure",1);
execl(_PATH_CAT
, "cat", TMPFILE
, 0);
fprintf(stderr
, "adventure: unable to find %s\n", _PATH_CAT
);
linkdata() /* secondary data manipulation */
for (i
=1; i
<=LOCSIZ
; i
++)
if (ltext
[i
].seekadr
!=0 && travel
[i
] != 0)
if ((travel
[i
]->tverb
)==1) cond
[i
]=2;
if (plac
[j
]!=0 && fixd
[j
]<=0) drop(j
,plac
[j
]);
for (i
=50; i
<=maxtrs
; i
++)
{ if (ptext
[i
].seekadr
!=0) prop
[i
] = -1;
pillow
=vocab("pillow",1);
oyster
=vocab("oyster",1);
/* random flags & ctrs */
if (rtext
[2*i
+81].seekadr
!=0) maxdie
=i
+1;
numdie
=holdng
=dkill
=foobar
=bonus
=0;
closng
=panic
=closed
=scorng
=FALSE
;
trapdel() /* come here if he hits a del */
{ delhit
++; /* main checks, treats as QUIT */
signal(2,trapdel
); /* catch subsequent DELs */
srand((int)(time((time_t *)NULL
))); /* random seed */
/* srand(371); /* non-random seed */
if (hinted
[3]) limit
=1000; /* better batteries if instrucs */