|
|
1.1 root 1: #include "trek.h"
2:
3: /**
4: ** get status info
5: **/
6:
7: char *Color[4]
8: {
9: "GREEN",
10: "DOCKED",
11: "YELLOW",
12: "RED"
13: };
14:
15: CVNTAB Infotab[]
16: {
17: "st", "ardate",
18: "c", "ondition",
19: "p", "osition",
20: "w", "arp",
21: "e", "nergy",
22: "to", "rpedo",
23: "sh", "ields",
24: "k", "lingons",
25: "t", "ime",
26: "l", "ife",
27: "cr", "ew",
28: "br", "ig",
29: 0
30: };
31:
32: info()
33: {
34: register int i;
35:
36: if((i=getcodpar("Request", Infotab))<0) return;
37: getinfo(i);
38: }
39:
40: getinfo(i)
41: {
42: register char *s;
43:
44: switch (i)
45: {
46: case 0:
47: printf("stardate %.2f", Status.date);
48: break;
49: case 1:
50: printf("condition %s", Color[Status.cond]);
51: if (Status.cloaked)
52: printf(", CLOAKED");
53: break;
54: case 2:
55: printf("position %d,%d/%d,%d",Quadx, Quady, Sectx, Secty);
56: break;
57: case 3:
58: printf("warp factor %.1f", Status.warp);
59: break;
60: case 4:
61: printf("total energy %d", Status.energy);
62: break;
63: case 5:
64: printf("torpedoes %d", Status.torped);
65: break;
66: case 6:
67: s = "down";
68: if (Status.shldup)
69: s = "up";
70: if (Damage[SHIELD])
71: s = "damaged";
72: printf("shields %s, %d%%", s, effshld());
73: break;
74: case 7:
75: printf("Klingons left %d", Status.kling);
76: break;
77: case 8:
78: printf("time left %.2f", Status.time);
79: break;
80: case 9:
81: printf("life support ");
82: if (Damage[LIFESUP])
83: {
84: printf("damaged, reserves = %.2f", Status.reserves);
85: break;
86: }
87: printf("active");
88: break;
89:
90: case 10:
91: printf("crew\t%d", Status.crew);
92: break;
93:
94: case 11:
95: printf("brig space\t%d", Status.brigfree);
96: break;
97: }
98: printf("\n");
99: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.