xref: /original-bsd/games/trek/damaged.c (revision a95f03a8)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)damaged.c	5.4 (Berkeley) 06/01/90";
10 #endif /* not lint */
11 
12 # include	"trek.h"
13 
14 /*  DAMAGED -- check for device damaged
15 **
16 **	This is a boolean function which returns non-zero if the
17 **	specified device is broken.  It does this by checking the
18 **	event list for a "device fix" action on that device.
19 */
20 
21 damaged(dev)
22 int	dev;
23 {
24 	register int		d;
25 	register struct event	*e;
26 	register int		i;
27 
28 	d = dev;
29 
30 	for (i = 0; i < MAXEVENTS; i++)
31 	{
32 		e = &Event[i];
33 		if (e->evcode != E_FIXDV)
34 			continue;
35 		if (e->systemname == d)
36 			return (1);
37 	}
38 
39 	/* device fix not in event list -- device must not be broken */
40 	return (0);
41 }
42