6 void attakreport(void) {
\r
7 if (game.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(game.future[FCDBAS], 0,1);
\r
16 proutn("Starbase in ");
\r
17 cramlc(1, game.state.isx, game.state.isy);
\r
18 prout(" is under Super-commander attack.");
\r
19 proutn("It can hold out until Stardate ");
\r
20 cramf(game.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
46 prout("You %s playing a %s%s %s game.",
\r
47 alldone? "were": "are now", s1, s2, s3);
\r
48 if (skill>3 && thawed && !alldone) prout("No plaque is allowed.");
\r
49 if (tourn) prout("This is tournament game %d.", tourn);
\r
50 if (f) prout("Your secret password is \"%s\"",game.passwd);
\r
51 proutn("%d of %d Klingons have been killed",
\r
52 game.state.killk+game.state.killc+game.state.nsckill, inkling);
\r
53 if (game.state.killc) prout(", including %d Commander%s.", game.state.killc, game.state.killc==1?"":"s");
\r
54 else if (game.state.killk+game.state.nsckill > 0) prout(", but no Commanders.");
\r
56 if (skill > 2) prout("The Super Commander has %sbeen destroyed.",
\r
57 game.state.nscrem?"not ":"");
\r
58 if (game.state.rembase != inbase) {
\r
60 if (inbase-game.state.rembase==1) proutn("has been 1 base");
\r
62 proutn("have been %d bases", inbase-game.state.rembase);
\r
64 prout(" destroyed, %d remaining.", game.state.rembase);
\r
66 else prout("There are %d bases.", inbase);
\r
67 if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED || iseenit) {
\r
68 /* Don't report this if not seen and
\r
69 either the radio is dead or not at base! */
\r
73 if (casual) prout("%d casualt%s suffered so far.",
\r
74 casual, casual==1? "y" : "ies");
\r
75 if (nhelp) prout("There were %d call%s for help.",
\r
76 nhelp, nhelp==1 ? "" : "s");
\r
78 proutn("You have ");
\r
79 if (nprobes) proutn("%d", nprobes);
\r
81 proutn(" deep space probe");
\r
82 if (nprobes!=1) proutn("s");
\r
85 if ((game.damage[DRADIO] == 0.0 || condit == IHDOCKED)&&
\r
86 game.future[FDSPROB] != 1e30) {
\r
88 proutn("An armed deep space probe is in");
\r
90 proutn("A deep space probe is in");
\r
91 cramlc(1, probecx, probecy);
\r
96 prout("Dilithium crystals aboard ship...not yet used.");
\r
100 while (cryprob > ai) {
\r
104 prout("Dilithium crystals have been used %d time%s.",
\r
105 i, i==1? "" : "s");
\r
111 void lrscan(void) {
\r
114 if (game.damage[DLRSENS] != 0.0) {
\r
115 /* Now allow base's sensors if docked */
\r
116 if (condit != IHDOCKED) {
\r
117 prout("LONG-RANGE SENSORS DAMAGED.");
\r
121 proutn("Starbase's long-range scan for");
\r
125 proutn("Long-range scan for");
\r
127 cramlc(1, quadx, quady);
\r
129 for (x = quadx-1; x <= quadx+1; x++) {
\r
130 for (y = quady-1; y <= quady+1; y++) {
\r
131 if (x == 0 || x > 8 || y == 0 || y > 8)
\r
134 proutn("%5d", game.state.galaxy[x][y]);
\r
135 game.starch[x][y] = game.damage[DRADIO] > 0 ? game.state.galaxy[x][y]+1000 :1;
\r
143 void dreprt(void) {
\r
144 int jdam = FALSE, i;
\r
147 for (i = 1; i <= NDEVICES; i++) {
\r
148 if (game.damage[i] > 0.0) {
\r
151 prout("DEVICE -REPAIR TIMES-");
\r
152 prout(" IN FLIGHT DOCKED");
\r
155 proutn(" %16s ", device[i]);
\r
156 cramf(game.damage[i]+0.05, 8, 2);
\r
158 cramf(docfac*game.damage[i]+0.005, 8, 2);
\r
162 if (!jdam) prout("All devices functional.");
\r
165 void chart(int nn) {
\r
170 if (stdamtim != 1e30 && stdamtim != game.state.date && condit == IHDOCKED) {
\r
171 prout("Spock- \"I revised the Star Chart from the");
\r
172 prout(" starbase's records.\"");
\r
175 if (nn == 0) prout("STAR CHART FOR THE KNOWN GALAXY");
\r
176 if (stdamtim != 1e30) {
\r
177 if (condit == IHDOCKED) {
\r
178 /* We are docked, so restore chart from base information */
\r
179 stdamtim = game.state.date;
\r
180 for (i=1; i <= 8 ; i++)
\r
181 for (j=1; j <= 8; j++)
\r
182 if (game.starch[i][j] == 1) game.starch[i][j] = game.state.galaxy[i][j]+1000;
\r
185 proutn("(Last surveillance update ");
\r
186 cramf(game.state.date-stdamtim, 0, 1);
\r
187 prout(" stardates ago.)");
\r
190 if (nn ==0) skip(1);
\r
192 prout(" 1 2 3 4 5 6 7 8");
\r
193 prout(" ----------------------------------------");
\r
194 /* if (nn==0) prout(" -"); */
\r
195 for (i = 1; i <= 8; i++) {
\r
197 for (j = 1; j <= 8; j++) {
\r
198 if (game.starch[i][j] < 0)
\r
200 else if (game.starch[i][j] == 0)
\r
202 else if (game.starch[i][j] > 999)
\r
203 proutn("%5d", game.starch[i][j]-1000);
\r
205 proutn("%5d", game.state.galaxy[i][j]);
\r
212 proutn(" is currently in");
\r
213 cramlc(1, quadx, quady);
\r
219 void srscan(int l) {
\r
220 static char requests[][3] =
\r
221 {"","da","co","po","ls","wa","en","to","sh","kl","ti"};
\r
223 int leftside=TRUE, rightside=TRUE, i, j, jj, k=0, nn=FALSE;
\r
227 if (game.damage[DSRSENS] != 0) {
\r
228 /* Allow base's sensors if docked */
\r
229 if (condit != IHDOCKED) {
\r
230 prout("SHORT-RANGE SENSORS DAMAGED");
\r
234 prout("[Using starbase's sensors]");
\r
237 game.starch[quadx][quady] = game.damage[DRADIO]>0.0 ?
\r
238 game.state.galaxy[quadx][quady]+1000:1;
\r
240 if (isit("chart")) nn = TRUE;
\r
241 if (isit("no")) rightside = FALSE;
\r
243 prout("\n 1 2 3 4 5 6 7 8 9 10");
\r
246 while (scan() == IHEOL)
\r
247 proutn("Information desired? ");
\r
249 for (k = 1; k <= 10; k++)
\r
250 if (strncmp(citem,requests[k],min(2,strlen(citem)))==0)
\r
253 prout("UNRECOGNIZED REQUEST. Legal requests are:\n"
\r
254 " date, condition, position, lsupport, warpfactor,\n"
\r
255 " energy, torpedoes, shields, klingons, time.");
\r
264 for (i = 1; i <= 10; i++) {
\r
265 int jj = (k!=0 ? k : i);
\r
268 for (j = 1; j <= 10; j++) {
\r
269 if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1))
\r
270 proutn("%c ",game.quad[i][j]);
\r
278 proutn(" Stardate %.1f", game.state.date);
\r
281 if (condit != IHDOCKED) newcnd();
\r
283 case IHRED: cp = "RED"; break;
\r
284 case IHGREEN: cp = "GREEN"; break;
\r
285 case IHYELLOW: cp = "YELLOW"; break;
\r
286 case IHDOCKED: cp = "DOCKED"; break;
\r
288 proutn(" Condition %s", cp);
\r
291 proutn(" Position ");
\r
292 cramlc(0, quadx, quady);
\r
294 cramlc(0, sectx, secty);
\r
297 proutn(" Life Support ");
\r
298 if (game.damage[DLIFSUP] != 0.0) {
\r
299 if (condit == IHDOCKED)
\r
300 proutn("DAMAGED, supported by starbase");
\r
302 proutn("DAMAGED, reserves=%4.2f", lsupres);
\r
308 proutn(" Warp Factor %.1f", warpfac);
\r
311 proutn(" Energy %.2f", energy);
\r
314 proutn(" Torpedoes %d", torps);
\r
317 proutn(" Shields ");
\r
318 if (game.damage[DSHIELD] != 0)
\r
319 proutn("DAMAGED,");
\r
324 proutn(" %d%% %.1f units",
\r
325 (int)((100.0*shield)/inshld + 0.5), shield);
\r
328 proutn(" Klingons Left %d", game.state.remkl);
\r
331 proutn(" Time Left %.2f", game.state.remtime);
\r
344 int key, ix1, ix2, iy1, iy2, prompt=FALSE;
\r
346 double ttime, twarp, tpower;
\r
347 if (game.damage[DCOMPTR] != 0.0) {
\r
348 prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR.");
\r
352 if (scan() != IHREAL) {
\r
355 proutn("Destination quadrant and/or sector? ");
\r
356 if (scan()!=IHREAL) {
\r
362 if (scan() != IHREAL) {
\r
366 ix1 = aaitem + 0.5;
\r
367 if (scan() == IHREAL) {
\r
368 iy2 = aaitem + 0.5;
\r
369 if (scan() != IHREAL) {
\r
373 ix2 = aaitem + 0.5;
\r
375 else { // same quadrant
\r
378 ix1 = quady; // ya got me why x and y are reversed!
\r
382 if (ix1 > 8 || ix1 < 1 || iy1 > 8 || iy1 < 1 ||
\r
383 ix2 > 10 || ix2 < 1 || iy2 > 10 || iy2 < 1) {
\r
387 dist = sqrt(square(iy1-quadx+0.1*(iy2-sectx))+
\r
388 square(ix1-quady+0.1*(ix2-secty)));
\r
391 if (prompt) prout("Answer \"no\" if you don't know the value:");
\r
394 proutn("Time or arrival date? ");
\r
395 if (scan()==IHREAL) {
\r
397 if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date
\r
398 if (ttime <= 1e-10 ||
\r
399 (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) {
\r
400 prout("We'll never make it, sir.");
\r
404 if (twarp < 1.0) twarp = 1.0;
\r
408 proutn("Warp factor? ");
\r
409 if (scan()== IHREAL) {
\r
412 if (twarp<1.0 || twarp > 10.0) {
\r
418 prout("Captain, certainly you can give me one of these.");
\r
422 ttime = (10.0*dist)/square(twarp);
\r
423 tpower = dist*twarp*twarp*twarp*(shldup+1);
\r
424 if (tpower >= energy) {
\r
425 prout("Insufficient energy, sir.");
\r
426 if (shldup==0 || tpower > energy*2.0) {
\r
428 proutn("New warp factor to try? ");
\r
429 if (scan() == IHREAL) {
\r
432 if (twarp<1.0 || twarp > 10.0) {
\r
444 prout("But if you lower your shields,");
\r
445 proutn("remaining");
\r
449 proutn("Remaining");
\r
450 proutn(" energy will be ");
\r
451 cramf(energy-tpower, 1, 1);
\r
454 proutn("And we will arrive at stardate ");
\r
455 cramf(game.state.date+ttime, 1, 1);
\r
458 else if (twarp==1.0)
\r
459 prout("Any warp speed is adequate.");
\r
461 proutn("Minimum warp needed is ");
\r
462 cramf(twarp, 1, 2);
\r
464 proutn("and we will arrive at stardate ");
\r
465 cramf(game.state.date+ttime, 1, 2);
\r
468 if (game.state.remtime < ttime)
\r
469 prout("Unfortunately, the Federation will be destroyed by then.");
\r
471 prout("You'll be taking risks at that speed, Captain");
\r
472 if ((isatb==1 && game.state.isy == ix1 && game.state.isx == iy1 &&
\r
473 game.future[FSCDBAS]< ttime+game.state.date)||
\r
474 (game.future[FCDBAS]<ttime+game.state.date && baty==ix1 && batx == iy1))
\r
475 prout("The starbase there will be destroyed by then.");
\r
476 proutn("New warp factor to try? ");
\r
477 if (scan() == IHREAL) {
\r
480 if (twarp<1.0 || twarp > 10.0) {
\r