xref: /csrg-svn/games/trek/check_out.c (revision 11660)
1*11660Smckusick #ifndef lint
2*11660Smckusick static char sccsid[] = "@(#)check_out.c	4.1	(Berkeley)	03/23/83";
3*11660Smckusick #endif not lint
4*11660Smckusick 
5*11660Smckusick # include	"trek.h"
6*11660Smckusick 
7*11660Smckusick /*
8*11660Smckusick **  CHECK IF A DEVICE IS OUT
9*11660Smckusick **
10*11660Smckusick **	The indicated device is checked to see if it is disabled.  If
11*11660Smckusick **	it is, an attempt is made to use the starbase device.  If both
12*11660Smckusick **	of these fails, it returns non-zero (device is REALLY out),
13*11660Smckusick **	otherwise it returns zero (I can get to it somehow).
14*11660Smckusick **
15*11660Smckusick **	It prints appropriate messages too.
16*11660Smckusick */
17*11660Smckusick 
18*11660Smckusick check_out(device)
19*11660Smckusick int	device;
20*11660Smckusick {
21*11660Smckusick 	register int	dev;
22*11660Smckusick 
23*11660Smckusick 	dev = device;
24*11660Smckusick 
25*11660Smckusick 	/* check for device ok */
26*11660Smckusick 	if (!damaged(dev))
27*11660Smckusick 		return (0);
28*11660Smckusick 
29*11660Smckusick 	/* report it as being dead */
30*11660Smckusick 	out(dev);
31*11660Smckusick 
32*11660Smckusick 	/* but if we are docked, we can go ahead anyhow */
33*11660Smckusick 	if (Ship.cond != DOCKED)
34*11660Smckusick 		return (1);
35*11660Smckusick 	printf("  Using starbase %s\n", Device[dev].name);
36*11660Smckusick 	return (0);
37*11660Smckusick }
38