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