changed csvax:linton to linton@ucbvax
[unix-history] / usr / src / games / trek / impulse.c
CommitLineData
d4b795ee 1#ifndef lint
35b95499 2static char sccsid[] = "@(#)impulse.c 4.2 (Berkeley) %G%";
d4b795ee
KM
3#endif not lint
4
5# include "trek.h"
6
7/**
8 ** move under impulse power
9 **/
10
11impulse()
12{
13 int course;
14 register int power;
15 float dist, time;
16 register int percent;
17 extern float move();
18
19 if (Ship.cond == DOCKED)
20 return (printf("Scotty: Sorry captain, but we are still docked.\n"));
21 if (damaged(IMPULSE))
22 return (out(IMPULSE));
23 if (getcodi(&course, &dist))
24 return;
25 power = 20 + 100 * dist;
26 percent = 100 * power / Ship.energy + 0.5;
27 if (percent >= 85)
28 {
29 printf("Scotty: That would consume %d%% of our remaining energy.\n",
30 percent);
31 if (!getynpar("Are you sure that is wise"))
32 return;
33 printf("Aye aye, sir\n");
34 }
35 time = dist / 0.095;
36 percent = 100 * time / Now.time + 0.5;
37 if (percent >= 85)
38 {
39 printf("Spock: That would take %d%% of our remaining time.\n",
40 percent);
41 if (!getynpar("Are you sure that is wise"))
42 return;
43 printf("(He's finally gone mad)\n");
44 }
45 Move.time = move(0, course, time, 0.095);
35b95499 46 Ship.energy -= 20 + 100 * Move.time * 0.095;
d4b795ee 47}