xref: /csrg-svn/games/trek/check_out.c (revision 34205)
121268Sdist /*
221268Sdist  * Copyright (c) 1980 Regents of the University of California.
3*34205Sbostic  * All rights reserved.
4*34205Sbostic  *
5*34205Sbostic  * Redistribution and use in source and binary forms are permitted
6*34205Sbostic  * provided that this notice is preserved and that due credit is given
7*34205Sbostic  * to the University of California at Berkeley. The name of the University
8*34205Sbostic  * may not be used to endorse or promote products derived from this
9*34205Sbostic  * software without specific prior written permission. This software
10*34205Sbostic  * is provided ``as is'' without express or implied warranty.
1121268Sdist  */
1221268Sdist 
1311660Smckusick #ifndef lint
14*34205Sbostic static char sccsid[] = "@(#)check_out.c	5.2 (Berkeley) 05/05/88";
15*34205Sbostic #endif /* not lint */
1611660Smckusick 
1711660Smckusick # include	"trek.h"
1811660Smckusick 
1911660Smckusick /*
2011660Smckusick **  CHECK IF A DEVICE IS OUT
2111660Smckusick **
2211660Smckusick **	The indicated device is checked to see if it is disabled.  If
2311660Smckusick **	it is, an attempt is made to use the starbase device.  If both
2411660Smckusick **	of these fails, it returns non-zero (device is REALLY out),
2511660Smckusick **	otherwise it returns zero (I can get to it somehow).
2611660Smckusick **
2711660Smckusick **	It prints appropriate messages too.
2811660Smckusick */
2911660Smckusick 
3011660Smckusick check_out(device)
3111660Smckusick int	device;
3211660Smckusick {
3311660Smckusick 	register int	dev;
3411660Smckusick 
3511660Smckusick 	dev = device;
3611660Smckusick 
3711660Smckusick 	/* check for device ok */
3811660Smckusick 	if (!damaged(dev))
3911660Smckusick 		return (0);
4011660Smckusick 
4111660Smckusick 	/* report it as being dead */
4211660Smckusick 	out(dev);
4311660Smckusick 
4411660Smckusick 	/* but if we are docked, we can go ahead anyhow */
4511660Smckusick 	if (Ship.cond != DOCKED)
4611660Smckusick 		return (1);
4711660Smckusick 	printf("  Using starbase %s\n", Device[dev].name);
4811660Smckusick 	return (0);
4911660Smckusick }
50