|
|
1.1 root 1: # include "trek.h"
2:
3: /**
4: ** move under impulse power
5: **/
6:
7: float newpos();
8:
9: # define ISPEED 0.095
10:
11: impulse()
12: {
13: int course;
14: register int power;
15: float dist, time;
16: register int percent;
17:
18: if (Status.cond == DOCKED) {
19: printf("Scotty: Sorry captain, but we are still docked\n");
20: return;
21: }
22: if (Damage[IMPULSE]) {
23: printf("Scotty: Our impulse engines are damaged\n");
24: return;
25: }
26: if (getcodi(&course, &dist)==0)
27: return;
28: power = 20 + 100 * dist;
29: percent = 100 * power / Status.energy + 0.5;
30: if (percent >= 85)
31: {
32: printf("Scotty: That would consume %d%% of our remaining energy.\n",
33: percent);
34: if (!getynpar("Are you sure that is wise"))
35: return;
36: printf("Aye aye, sir\n");
37: }
38: time = dist / ISPEED;
39: percent = 100 * time / Status.time + 0.5;
40: if (percent >= 85)
41: {
42: printf("Spock: That would take %d%% of our remaining time.\n",
43: percent);
44: if (!getynpar("Are you sure that is wise"))
45: return;
46: printf("(He's finally gone mad)\n");
47: }
48: Move.delta = newpos(0, course, time, ISPEED);
49: dist = Move.delta * ISPEED;
50: Status.energy =- 20 + 100 * dist;
51: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.