xref: /original-bsd/games/trek/damaged.c (revision 1a56dd2c)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that this notice is preserved and that due credit is given
7  * to the University of California at Berkeley. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  */
12 
13 #ifndef lint
14 static char sccsid[] = "@(#)damaged.c	5.2 (Berkeley) 05/05/88";
15 #endif /* not lint */
16 
17 # include	"trek.h"
18 
19 /*  DAMAGED -- check for device damaged
20 **
21 **	This is a boolean function which returns non-zero if the
22 **	specified device is broken.  It does this by checking the
23 **	event list for a "device fix" action on that device.
24 */
25 
26 damaged(dev)
27 int	dev;
28 {
29 	register int		d;
30 	register struct event	*e;
31 	register int		i;
32 
33 	d = dev;
34 
35 	for (i = 0; i < MAXEVENTS; i++)
36 	{
37 		e = &Event[i];
38 		if (e->evcode != E_FIXDV)
39 			continue;
40 		if (e->systemname == d)
41 			return (1);
42 	}
43 
44 	/* device fix not in event list -- device must not be broken */
45 	return (0);
46 }
47