6 void attakreport(void) {
\r
7 if (future[FCDBAS] < 1e30) {
\r
8 proutn("Starbase in ");
\r
9 cramlc(1, batx, baty);
\r
10 prout(" is currently under attack.");
\r
11 proutn("It can hold out until Stardate ");
\r
12 cramf(future[FCDBAS], 0,1);
\r
16 proutn("Starbase in ");
\r
17 cramlc(1, state.isx, state.isy);
\r
18 prout(" is under Super-commander attack.");
\r
19 proutn("It can hold out until Stardate ");
\r
20 cramf(future[FSCDBAS], 0, 1);
\r
26 void report(int f) {
\r
30 s1 = (thawed?"thawed ":"");
\r
32 case 1: s2="short"; break;
\r
33 case 2: s2="medium"; break;
\r
34 case 4: s2="long"; break;
\r
35 default: s2="unknown length"; break;
\r
38 case 1: s3="novice"; break;
\r
39 case 2: s3="fair"; break;
\r
40 case 3: s3="good"; break;
\r
41 case 4: s3="expert"; break;
\r
42 case 5: s3="emeritus"; break;
\r
43 default: s3="skilled"; break;
\r
45 printf("\nYou %s playing a %s%s %s frozen.\n",
\r
46 alldone? "were": "are now", s1, s2, s3);
\r
47 if (skill>3 && thawed && !alldone) prout("No plaque is allowed.");
\r
48 if (tourn) printf("This is tournament game %d.\n", tourn);
\r
49 if (f) printf("Your secret password is \"%s\"\n",passwd);
\r
50 printf("%d of %d Klingons have been killed",
\r
51 state.killk+state.killc+state.nsckill, inkling);
\r
52 if (state.killc) printf(", including %d Commander%s.\n", state.killc, state.killc==1?"":"s");
\r
53 else if (state.killk+state.nsckill > 0) prout(", but no Commanders.");
\r
55 if (skill > 2) printf("The Super Commander has %sbeen destroyed.\n",
\r
56 state.nscrem?"not ":"");
\r
57 if (state.rembase != inbase) {
\r
59 if (inbase-state.rembase==1) proutn("has been 1 base");
\r
61 proutn("have been ");
\r
62 crami(inbase-state.rembase, 1);
\r
65 proutn(" destroyed, ");
\r
66 crami(state.rembase, 1);
\r
67 prout(" remaining.");
\r
69 else printf("There are %d bases.\n", inbase);
\r
70 if (damage[DRADIO] == 0.0 || condit == IHDOCKED || iseenit) {
\r
71 /* Don't report this if not seen and
\r
72 either the radio is dead or not at base! */
\r
76 if (casual) printf("%d casualt%s suffered so far.\n",
\r
77 casual, casual==1? "y" : "ies");
\r
78 if (nhelp) printf("There were %d call%s for help.\n",
\r
79 nhelp, nhelp==1 ? "" : "s");
\r
81 proutn("You have ");
\r
82 if (nprobes) crami(nprobes,1);
\r
84 proutn(" deep space probe");
\r
85 if (nprobes!=1) proutn("s");
\r
88 if ((damage[DRADIO] == 0.0 || condit == IHDOCKED)&&
\r
89 future[FDSPROB] != 1e30) {
\r
91 proutn("An armed deep space probe is in");
\r
93 proutn("A deep space probe is in");
\r
94 cramlc(1, probecx, probecy);
\r
99 prout("Dilithium crystals aboard ship...not yet used.");
\r
103 while (cryprob > ai) {
\r
107 printf("Dilithium crystals have been used %d time%s.\n",
\r
108 i, i==1? "" : "s");
\r
114 void lrscan(void) {
\r
117 if (damage[DLRSENS] != 0.0) {
\r
118 /* Now allow base's sensors if docked */
\r
119 if (condit != IHDOCKED) {
\r
120 prout("LONG-RANGE SENSORS DAMAGED.");
\r
124 proutn("Starbase's long-range scan for");
\r
128 proutn("Long-range scan for");
\r
130 cramlc(1, quadx, quady);
\r
132 for (x = quadx-1; x <= quadx+1; x++) {
\r
133 for (y = quady-1; y <= quady+1; y++) {
\r
134 if (x == 0 || x > 8 || y == 0 || y > 8)
\r
137 printf("%5d", state.galaxy[x][y]);
\r
138 starch[x][y] = damage[DRADIO] > 0 ? state.galaxy[x][y]+1000 :1;
\r
146 void dreprt(void) {
\r
147 int jdam = FALSE, i;
\r
150 for (i = 1; i <= ndevice; i++) {
\r
151 if (damage[i] > 0.0) {
\r
154 prout("DEVICE -REPAIR TIMES-");
\r
155 prout(" IN FLIGHT DOCKED");
\r
158 printf(" %16s ", device[i]);
\r
159 cramf(damage[i]+0.05, 8, 2);
\r
161 cramf(docfac*damage[i]+0.005, 8, 2);
\r
165 if (!jdam) prout("All devices functional.");
\r
168 void chart(int nn) {
\r
173 if (stdamtim != 1e30 && stdamtim != state.date && condit == IHDOCKED) {
\r
174 prout("Spock- \"I revised the Star Chart from the");
\r
175 prout(" starbase's records.\"");
\r
178 if (nn == 0) prout("STAR CHART FOR THE KNOWN GALAXY");
\r
179 if (stdamtim != 1e30) {
\r
180 if (condit == IHDOCKED) {
\r
181 /* We are docked, so restore chart from base information */
\r
182 stdamtim = state.date;
\r
183 for (i=1; i <= 8 ; i++)
\r
184 for (j=1; j <= 8; j++)
\r
185 if (starch[i][j] == 1) starch[i][j] = state.galaxy[i][j]+1000;
\r
188 proutn("(Last surveillance update ");
\r
189 cramf(state.date-stdamtim, 0, 1);
\r
190 prout(" stardates ago.)");
\r
193 if (nn ==0) skip(1);
\r
195 prout(" 1 2 3 4 5 6 7 8");
\r
196 prout(" ----------------------------------------");
\r
197 if (nn==0) prout(" -");
\r
198 for (i = 1; i <= 8; i++) {
\r
200 for (j = 1; j <= 8; j++) {
\r
201 if (starch[i][j] < 0)
\r
203 else if (starch[i][j] == 0)
\r
205 else if (starch[i][j] > 999)
\r
206 printf("%5d", starch[i][j]-1000);
\r
208 printf("%5d", state.galaxy[i][j]);
\r
215 proutn(" is currently in");
\r
216 cramlc(1, quadx, quady);
\r
222 void srscan(int l) {
\r
223 static char requests[][3] =
\r
224 {"","da","co","po","ls","wa","en","to","sh","kl","ti"};
\r
226 int leftside=TRUE, rightside=TRUE, i, j, jj, k=0, nn=FALSE;
\r
230 if (damage[DSRSENS] != 0) {
\r
231 /* Allow base's sensors if docked */
\r
232 if (condit != IHDOCKED) {
\r
233 prout("SHORT-RANGE SENSORS DAMAGED");
\r
237 prout("[Using starbase's sensors]");
\r
240 starch[quadx][quady] = damage[DRADIO]>0.0 ?
\r
241 state.galaxy[quadx][quady]+1000:1;
\r
243 if (isit("chart")) nn = TRUE;
\r
244 if (isit("no")) rightside = FALSE;
\r
246 prout("\n 1 2 3 4 5 6 7 8 9 10");
\r
249 while (scan() == IHEOL)
\r
250 printf("Information desired? ");
\r
252 for (k = 1; k <= 10; k++)
\r
253 if (strncmp(citem,requests[k],min(2,strlen(citem)))==0)
\r
256 prout("UNRECOGNIZED REQUEST. Legal requests are:\n"
\r
257 " date, condition, position, lsupport, warpfactor,\n"
\r
258 " energy, torpedoes, shields, klingons, time.");
\r
267 for (i = 1; i <= 10; i++) {
\r
268 int jj = (k!=0 ? k : i);
\r
271 for (j = 1; j <= 10; j++) {
\r
272 if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1))
\r
273 printf("%c ",frozen.quad[i][j]);
\r
281 printf(" Stardate %.1f", state.date);
\r
284 if (condit != IHDOCKED) newcnd();
\r
286 case IHRED: cp = "RED"; break;
\r
287 case IHGREEN: cp = "GREEN"; break;
\r
288 case IHYELLOW: cp = "YELLOW"; break;
\r
289 case IHDOCKED: cp = "DOCKED"; break;
\r
291 printf(" Condition %s", cp);
\r
294 printf(" Position ");
\r
295 cramlc(0, quadx, quady);
\r
297 cramlc(0, sectx, secty);
\r
300 printf(" Life Support ");
\r
301 if (damage[DLIFSUP] != 0.0) {
\r
302 if (condit == IHDOCKED)
\r
303 printf("DAMAGED, supported by starbase");
\r
305 printf("DAMAGED, reserves=%4.2f", lsupres);
\r
311 printf(" Warp Factor %.1f", warpfac);
\r
314 printf(" Energy %.2f", energy);
\r
317 printf(" Torpedoes %d", torps);
\r
320 printf(" Shields ");
\r
321 if (damage[DSHIELD] != 0)
\r
322 printf("DAMAGED,");
\r
327 printf(" %d%% %.1f units",
\r
328 (int)((100.0*shield)/inshld + 0.5), shield);
\r
331 printf(" Klingons Left %d", state.remkl);
\r
334 printf(" Time Left %.2f", state.remtime);
\r
347 int key, ix1, ix2, iy1, iy2, prompt=FALSE;
\r
349 double ttime, twarp, tpower;
\r
350 if (damage[DCOMPTR] != 0.0) {
\r
351 prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR.");
\r
355 if (scan() != IHREAL) {
\r
358 proutn("Destination quadrant and/or sector? ");
\r
359 if (scan()!=IHREAL) {
\r
365 if (scan() != IHREAL) {
\r
369 ix1 = aaitem + 0.5;
\r
370 if (scan() == IHREAL) {
\r
371 iy2 = aaitem + 0.5;
\r
372 if (scan() != IHREAL) {
\r
376 ix2 = aaitem + 0.5;
\r
378 else { // same quadrant
\r
381 ix1 = quady; // ya got me why x and y are reversed!
\r
385 if (ix1 > 8 || ix1 < 1 || iy1 > 8 || iy1 < 1 ||
\r
386 ix2 > 10 || ix2 < 1 || iy2 > 10 || iy2 < 1) {
\r
390 dist = sqrt(square(iy1-quadx+0.1*(iy2-sectx))+
\r
391 square(ix1-quady+0.1*(ix2-secty)));
\r
394 if (prompt) prout("Answer \"no\" if you don't know the value:");
\r
397 proutn("Time or arrival date? ");
\r
398 if (scan()==IHREAL) {
\r
400 if (ttime > state.date) ttime -= state.date; // Actually a star date
\r
401 if (ttime <= 1e-10 ||
\r
402 (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) {
\r
403 prout("We'll never make it, sir.");
\r
407 if (twarp < 1.0) twarp = 1.0;
\r
411 proutn("Warp factor? ");
\r
412 if (scan()== IHREAL) {
\r
415 if (twarp<1.0 || twarp > 10.0) {
\r
421 prout("Captain, certainly you can give me one of these.");
\r
425 ttime = (10.0*dist)/square(twarp);
\r
426 tpower = dist*twarp*twarp*twarp*(shldup+1);
\r
427 if (tpower >= energy) {
\r
428 prout("Insufficient energy, sir.");
\r
429 if (shldup==0 || tpower > energy*2.0) {
\r
431 proutn("New warp factor to try? ");
\r
432 if (scan() == IHREAL) {
\r
435 if (twarp<1.0 || twarp > 10.0) {
\r
447 prout("But if you lower your shields,");
\r
448 proutn("remaining");
\r
452 proutn("Remaining");
\r
453 proutn(" energy will be ");
\r
454 cramf(energy-tpower, 1, 1);
\r
457 proutn("And we will arrive at stardate ");
\r
458 cramf(state.date+ttime, 1, 1);
\r
461 else if (twarp==1.0)
\r
462 prout("Any warp speed is adequate.");
\r
464 proutn("Minimum warp needed is ");
\r
465 cramf(twarp, 1, 2);
\r
467 proutn("and we will arrive at stardate ");
\r
468 cramf(state.date+ttime, 1, 2);
\r
471 if (state.remtime < ttime)
\r
472 prout("Unfortunately, the Federation will be destroyed by then.");
\r
474 prout("You'll be taking risks at that speed, Captain");
\r
475 if ((isatb==1 && state.isy == ix1 && state.isx == iy1 &&
\r
476 future[FSCDBAS]< ttime+state.date)||
\r
477 (future[FCDBAS]<ttime+state.date && baty==ix1 && batx == iy1))
\r
478 prout("The starbase there will be destroyed by then.");
\r
479 proutn("New warp factor to try? ");
\r
480 if (scan() == IHREAL) {
\r
483 if (twarp<1.0 || twarp > 10.0) {
\r