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