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