xref: /original-bsd/games/trek/rest.c (revision 4ec22e22)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)rest.c	5.4 (Berkeley) 06/01/90";
10 #endif /* not lint */
11 
12 # include	"trek.h"
13 # include	"getpar.h"
14 
15 /*
16 **  REST FOR REPAIRS
17 **
18 **	You sit around and wait for repairs to happen.  Actually, you
19 **	sit around and wait for anything to happen.  I do want to point
20 **	out however, that Klingons are not as patient as you are, and
21 **	they tend to attack you while you are resting.
22 **
23 **	You can never rest through a long range tractor beam.
24 **
25 **	In events() you will be given an opportunity to cancel the
26 **	rest period if anything momentous happens.
27 */
28 
29 rest()
30 {
31 	double			t;
32 	register int		percent;
33 
34 	/* get the time to rest */
35 	t = getfltpar("How long");
36 	if (t <= 0.0)
37 		return;
38 	percent = 100 * t / Now.time + 0.5;
39 	if (percent >= 70)
40 	{
41 		printf("Spock: That would take %d%% of our remaining time.\n",
42 			percent);
43 		if (!getynpar("Are you really certain that is wise"))
44 			return;
45 	}
46 	Move.time = t;
47 
48 	/* boundary condition is the LRTB */
49 	t = Now.eventptr[E_LRTB]->date - Now.date;
50 	if (Ship.cond != DOCKED && Move.time > t)
51 		Move.time = t + 0.0001;
52 	Move.free = 0;
53 	Move.resting = 1;
54 }
55