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