xref: /csrg-svn/games/trek/check_out.c (revision 60857)
121268Sdist /*
2*60857Sbostic  * Copyright (c) 1980, 1993
3*60857Sbostic  *	The Regents of the University of California.  All rights reserved.
434205Sbostic  *
542605Sbostic  * %sccs.include.redist.c%
621268Sdist  */
721268Sdist 
811660Smckusick #ifndef lint
9*60857Sbostic static char sccsid[] = "@(#)check_out.c	8.1 (Berkeley) 05/31/93";
1034205Sbostic #endif /* not lint */
1111660Smckusick 
1211660Smckusick # include	"trek.h"
1311660Smckusick 
1411660Smckusick /*
1511660Smckusick **  CHECK IF A DEVICE IS OUT
1611660Smckusick **
1711660Smckusick **	The indicated device is checked to see if it is disabled.  If
1811660Smckusick **	it is, an attempt is made to use the starbase device.  If both
1911660Smckusick **	of these fails, it returns non-zero (device is REALLY out),
2011660Smckusick **	otherwise it returns zero (I can get to it somehow).
2111660Smckusick **
2211660Smckusick **	It prints appropriate messages too.
2311660Smckusick */
2411660Smckusick 
check_out(device)2511660Smckusick check_out(device)
2611660Smckusick int	device;
2711660Smckusick {
2811660Smckusick 	register int	dev;
2911660Smckusick 
3011660Smckusick 	dev = device;
3111660Smckusick 
3211660Smckusick 	/* check for device ok */
3311660Smckusick 	if (!damaged(dev))
3411660Smckusick 		return (0);
3511660Smckusick 
3611660Smckusick 	/* report it as being dead */
3711660Smckusick 	out(dev);
3811660Smckusick 
3911660Smckusick 	/* but if we are docked, we can go ahead anyhow */
4011660Smckusick 	if (Ship.cond != DOCKED)
4111660Smckusick 		return (1);
4211660Smckusick 	printf("  Using starbase %s\n", Device[dev].name);
4311660Smckusick 	return (0);
4411660Smckusick }
45