xref: /csrg-svn/games/trek/damaged.c (revision 60857)
121272Sdist /*
2*60857Sbostic  * Copyright (c) 1980, 1993
3*60857Sbostic  *	The Regents of the University of California.  All rights reserved.
434205Sbostic  *
542605Sbostic  * %sccs.include.redist.c%
621272Sdist  */
721272Sdist 
811665Smckusick #ifndef lint
9*60857Sbostic static char sccsid[] = "@(#)damaged.c	8.1 (Berkeley) 05/31/93";
1034205Sbostic #endif /* not lint */
1111665Smckusick 
1211665Smckusick # include	"trek.h"
1311665Smckusick 
1411665Smckusick /*  DAMAGED -- check for device damaged
1511665Smckusick **
1611665Smckusick **	This is a boolean function which returns non-zero if the
1711665Smckusick **	specified device is broken.  It does this by checking the
1811665Smckusick **	event list for a "device fix" action on that device.
1911665Smckusick */
2011665Smckusick 
damaged(dev)2111665Smckusick damaged(dev)
2211665Smckusick int	dev;
2311665Smckusick {
2411665Smckusick 	register int		d;
2511665Smckusick 	register struct event	*e;
2611665Smckusick 	register int		i;
2711665Smckusick 
2811665Smckusick 	d = dev;
2911665Smckusick 
3011665Smckusick 	for (i = 0; i < MAXEVENTS; i++)
3111665Smckusick 	{
3211665Smckusick 		e = &Event[i];
3311665Smckusick 		if (e->evcode != E_FIXDV)
3411665Smckusick 			continue;
3511665Smckusick 		if (e->systemname == d)
3611665Smckusick 			return (1);
3711665Smckusick 	}
3811665Smckusick 
3911665Smckusick 	/* device fix not in event list -- device must not be broken */
4011665Smckusick 	return (0);
4111665Smckusick }
42