Commit | Line | Data |
---|---|---|
b6f0a7e4 DF |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
e9fb6bea KB |
3 | * All rights reserved. |
4 | * | |
b2e7427f | 5 | * %sccs.include.redist.c% |
b6f0a7e4 DF |
6 | */ |
7 | ||
d4b795ee | 8 | #ifndef lint |
b2e7427f | 9 | static char sccsid[] = "@(#)impulse.c 5.4 (Berkeley) %G%"; |
e9fb6bea | 10 | #endif /* not lint */ |
d4b795ee KM |
11 | |
12 | # include "trek.h" | |
13 | ||
14 | /** | |
15 | ** move under impulse power | |
16 | **/ | |
17 | ||
18 | impulse() | |
19 | { | |
20 | int course; | |
21 | register int power; | |
06d69904 | 22 | double dist, time; |
d4b795ee | 23 | register int percent; |
06d69904 | 24 | extern double move(); |
d4b795ee KM |
25 | |
26 | if (Ship.cond == DOCKED) | |
27 | return (printf("Scotty: Sorry captain, but we are still docked.\n")); | |
28 | if (damaged(IMPULSE)) | |
29 | return (out(IMPULSE)); | |
30 | if (getcodi(&course, &dist)) | |
31 | return; | |
32 | power = 20 + 100 * dist; | |
33 | percent = 100 * power / Ship.energy + 0.5; | |
34 | if (percent >= 85) | |
35 | { | |
36 | printf("Scotty: That would consume %d%% of our remaining energy.\n", | |
37 | percent); | |
38 | if (!getynpar("Are you sure that is wise")) | |
39 | return; | |
40 | printf("Aye aye, sir\n"); | |
41 | } | |
42 | time = dist / 0.095; | |
43 | percent = 100 * time / Now.time + 0.5; | |
44 | if (percent >= 85) | |
45 | { | |
46 | printf("Spock: That would take %d%% of our remaining time.\n", | |
47 | percent); | |
48 | if (!getynpar("Are you sure that is wise")) | |
49 | return; | |
50 | printf("(He's finally gone mad)\n"); | |
51 | } | |
52 | Move.time = move(0, course, time, 0.095); | |
35b95499 | 53 | Ship.energy -= 20 + 100 * Move.time * 0.095; |
d4b795ee | 54 | } |