|
|
1.1 root 1: # include "trek.h"
2:
3:
4: int overide; /*set during autoveride*/
5:
6: /**
7: ** check for condition after a move
8: **/
9:
10: checkcond()
11: {
12: /* see if we are still alive and well */
13: if (Status.reserves < 0.0)
14: lose(L_NOLIFE);
15: if (Status.energy <= 0)
16: lose(L_NOENGY);
17: if (Status.crew <= 0)
18: lose(L_NOCREW);
19: /* if in auto override mode, ignore the rest */
20: if (overide)
21: return;
22: /* call in automatic override if appropriate */
23: if (Quad[Quadx][Quady].stars < 0)
24: autover();
25: if (Quad[Quadx][Quady].stars < 0)
26: lose(L_SNOVA);
27: /* nullify distress call if appropriate */
28: if (Nkling <= 0)
29: killd(Quadx, Quady);
30:
31: /* set condition code */
32: if (Status.cond == DOCKED)
33: return;
34:
35: if (Nkling > 0)
36: {
37: Status.cond = RED;
38: return;
39: }
40: if (Status.energy < 1000)
41: {
42: if(Status.cond!=YELLOW)
43: printf("Condition YELLOW\n");
44: Status.cond = YELLOW;
45: return;
46: }
47: Status.cond = GREEN;
48: return;
49: }
50:
51:
52: /**
53: ** automatic override in case of a supernova
54: **/
55:
56: autover()
57: {
58: float dist;
59: int course;
60:
61: printf("*** RED ALERT: The %s is in a supernova quadrant\n", Status.shipname);
62: printf("*** Emergency override attempts to hurl %s to safety\n", Status.shipname);
63: if (Damage[WARP]) {
64: printf("Warp engines damaged\n");
65: return;
66: }
67: /* let's get our ass out of here */
68: Status.warp = 6.0 + 2.0 * franf();
69: Status.warp2 = Status.warp * Status.warp;
70: Status.warp3 = Status.warp2 * Status.warp;
71: dist = 0.75 * Status.energy / (Status.warp3 * (Status.shldup + 1));
72: if (dist > 1.4142)
73: dist = 1.4142;
74: course = ranf(360);
75: Status.cond = RED;
76: overide++;
77: warp(0, course, dist);
78: overide=0;
79: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.