xref: /csrg-svn/games/trek/rest.c (revision 60859)
121291Sdist /*
2*60859Sbostic  * Copyright (c) 1980, 1993
3*60859Sbostic  *	The Regents of the University of California.  All rights reserved.
434205Sbostic  *
542606Sbostic  * %sccs.include.redist.c%
621291Sdist  */
721291Sdist 
811691Smckusick #ifndef lint
9*60859Sbostic static char sccsid[] = "@(#)rest.c	8.1 (Berkeley) 05/31/93";
1034205Sbostic #endif /* not lint */
1111691Smckusick 
1211691Smckusick # include	"trek.h"
1311691Smckusick # include	"getpar.h"
1411691Smckusick 
1511691Smckusick /*
1611691Smckusick **  REST FOR REPAIRS
1711691Smckusick **
1811691Smckusick **	You sit around and wait for repairs to happen.  Actually, you
1911691Smckusick **	sit around and wait for anything to happen.  I do want to point
2011691Smckusick **	out however, that Klingons are not as patient as you are, and
2111691Smckusick **	they tend to attack you while you are resting.
2211691Smckusick **
2311691Smckusick **	You can never rest through a long range tractor beam.
2411691Smckusick **
2511691Smckusick **	In events() you will be given an opportunity to cancel the
2611691Smckusick **	rest period if anything momentous happens.
2711691Smckusick */
2811691Smckusick 
rest()2911691Smckusick rest()
3011691Smckusick {
3112738Slayer 	double			t;
3211691Smckusick 	register int		percent;
3311691Smckusick 
3411691Smckusick 	/* get the time to rest */
3511691Smckusick 	t = getfltpar("How long");
3611691Smckusick 	if (t <= 0.0)
3711691Smckusick 		return;
3811691Smckusick 	percent = 100 * t / Now.time + 0.5;
3911691Smckusick 	if (percent >= 70)
4011691Smckusick 	{
4111691Smckusick 		printf("Spock: That would take %d%% of our remaining time.\n",
4211691Smckusick 			percent);
4311691Smckusick 		if (!getynpar("Are you really certain that is wise"))
4411691Smckusick 			return;
4511691Smckusick 	}
4611691Smckusick 	Move.time = t;
4711691Smckusick 
4811691Smckusick 	/* boundary condition is the LRTB */
4911691Smckusick 	t = Now.eventptr[E_LRTB]->date - Now.date;
5011691Smckusick 	if (Ship.cond != DOCKED && Move.time > t)
5111691Smckusick 		Move.time = t + 0.0001;
5211691Smckusick 	Move.free = 0;
5311691Smckusick 	Move.resting = 1;
5411691Smckusick }
55