|
|
1.1 root 1: #ifndef lint
2: static char sccsid[] = "@(#)srscan.c 4.2 (Berkeley) 5/27/83";
3: #endif not lint
4:
5: # include "trek.h"
6: # include "getpar.h"
7:
8: /*
9: ** SHORT RANGE SENSOR SCAN
10: **
11: ** A short range scan is taken of the current quadrant. If the
12: ** flag 'f' is one, it is an "auto srscan", which is not done
13: ** unless in 'fast' mode. It does a status report and a srscan.
14: ** If 'f' is -1, you get a status report only. If it is zero,
15: ** you get a srscan and an optional status report. The status
16: ** report is taken if you enter "srscan yes"; for all srscans
17: ** thereafter you get a status report with your srscan until
18: ** you type "srscan no". It defaults to on.
19: **
20: ** The current quadrant is filled in on the computer chart.
21: */
22:
23: char *Color[4] =
24: {
25: "GREEN",
26: "DOCKED",
27: "YELLOW",
28: "RED"
29: };
30:
31: srscan(f)
32: int f;
33: {
34: register int i, j;
35: register int statinfo;
36: char *s;
37: int percent;
38: struct quad *q;
39: extern struct cvntab Skitab[];
40: extern struct cvntab Lentab[];
41: struct cvntab *p;
42:
43: if (f >= 0 && check_out(SRSCAN))
44: {
45: return;
46: }
47: if (f)
48: statinfo = 1;
49: else
50: {
51: if (!testnl())
52: Etc.statreport = getynpar("status report");
53: statinfo = Etc.statreport;
54: }
55: if (f > 0)
56: {
57: Etc.statreport = 1;
58: if (!Etc.fast)
59: return;
60: }
61: if (f >= 0)
62: {
63: printf("\nShort range sensor scan\n");
64: q = &Quad[Ship.quadx][Ship.quady];
65: q->scanned = q->klings * 100 + q->bases * 10 + q->stars;
66: printf(" ");
67: for (i = 0; i < NSECTS; i++)
68: {
69: printf("%d ", i);
70: }
71: printf("\n");
72: }
73:
74: for (i = 0; i < NSECTS; i++)
75: {
76: if (f >= 0)
77: {
78: printf("%d ", i);
79: for (j = 0; j < NSECTS; j++)
80: printf("%c ", Sect[i][j]);
81: printf("%d", i);
82: if (statinfo)
83: printf(" ");
84: }
85: if (statinfo)
86: switch (i)
87: {
88: case 0:
89: printf("stardate %.2f", Now.date);
90: break;
91: case 1:
92: printf("condition %s", Color[Ship.cond]);
93: if (Ship.cloaked)
94: printf(", CLOAKED");
95: break;
96: case 2:
97: printf("position %d,%d/%d,%d",Ship.quadx, Ship.quady, Ship.sectx, Ship.secty);
98: break;
99: case 3:
100: printf("warp factor %.1f", Ship.warp);
101: break;
102: case 4:
103: printf("total energy %d", Ship.energy);
104: break;
105: case 5:
106: printf("torpedoes %d", Ship.torped);
107: break;
108: case 6:
109: s = "down";
110: if (Ship.shldup)
111: s = "up";
112: if (damaged(SHIELD))
113: s = "damaged";
114: percent = 100.0 * Ship.shield / Param.shield;
115: printf("shields %s, %d%%", s, percent);
116: break;
117: case 7:
118: printf("Klingons left %d", Now.klings);
119: break;
120: case 8:
121: printf("time left %.2f", Now.time);
122: break;
123: case 9:
124: printf("life support ");
125: if (damaged(LIFESUP))
126: {
127: printf("damaged, reserves = %.2f", Ship.reserves);
128: break;
129: }
130: printf("active");
131: break;
132: }
133: printf("\n");
134: }
135: if (f < 0)
136: {
137: printf("current crew %d\n", Ship.crew);
138: printf("brig space %d\n", Ship.brigfree);
139: printf("Klingon power %d\n", Param.klingpwr);
140: p = &Lentab[Game.length - 1];
141: if (Game.length > 2)
142: p--;
143: printf("Length, Skill %s%s, ", p->abrev, p->full);
144: p = &Skitab[Game.skill - 1];
145: printf("%s%s\n", p->abrev, p->full);
146: return;
147: }
148: printf(" ");
149: for (i = 0; i < NSECTS; i++)
150: printf("%d ", i);
151: printf("\n");
152:
153: if (q->qsystemname & Q_DISTRESSED)
154: printf("Distressed ");
155: if (q->qsystemname)
156: printf("Starsystem %s\n", systemname(q));
157: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.