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