6 void attakreport(void) {
\r
7 if (game.future[FCDBAS] < 1e30) {
\r
8 prout("Starbase in %s is currently under attack.",
\r
9 cramlc(quadrant, batx, baty));
\r
10 prout("It can hold out until Stardate %d.",
\r
11 (int)game.future[FCDBAS]);
\r
14 prout("Starbase in %s is under Super-commander attack.",
\r
15 cramlc(quadrant, game.state.isx, game.state.isy));
\r
16 prout("It can hold out until Stardate %d.",
\r
17 (int)game.future[FSCDBAS]);
\r
22 void report(int f) {
\r
26 s1 = (thawed?"thawed ":"");
\r
28 case 1: s2="short"; break;
\r
29 case 2: s2="medium"; break;
\r
30 case 4: s2="long"; break;
\r
31 default: s2="unknown length"; break;
\r
34 case 1: s3="novice"; break;
\r
35 case 2: s3="fair"; break;
\r
36 case 3: s3="good"; break;
\r
37 case 4: s3="expert"; break;
\r
38 case 5: s3="emeritus"; break;
\r
39 default: s3="skilled"; break;
\r
42 prout("You %s playing a %s%s %s game.",
\r
43 alldone? "were": "are now", s1, s2, s3);
\r
44 if (skill>3 && thawed && !alldone) prout("No plaque is allowed.");
\r
45 if (tourn) prout("This is tournament game %d.", tourn);
\r
46 if (f) prout("Your secret password is \"%s\"",game.passwd);
\r
47 proutn("%d of %d Klingons have been killed",
\r
48 game.state.killk+game.state.killc+game.state.nsckill, inkling);
\r
49 if (game.state.killc) prout(", including %d Commander%s.", game.state.killc, game.state.killc==1?"":"s");
\r
50 else if (game.state.killk+game.state.nsckill > 0) prout(", but no Commanders.");
\r
52 if (skill > 2) prout("The Super Commander has %sbeen destroyed.",
\r
53 game.state.nscrem?"not ":"");
\r
54 if (game.state.rembase != inbase) {
\r
56 if (inbase-game.state.rembase==1) proutn("has been 1 base");
\r
58 proutn("have been %d bases", inbase-game.state.rembase);
\r
60 prout(" destroyed, %d remaining.", game.state.rembase);
\r
62 else prout("There are %d bases.", inbase);
\r
63 if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED || iseenit) {
\r
64 /* Don't report this if not seen and
\r
65 either the radio is dead or not at base! */
\r
69 if (casual) prout("%d casualt%s suffered so far.",
\r
70 casual, casual==1? "y" : "ies");
\r
71 if (nhelp) prout("There were %d call%s for help.",
\r
72 nhelp, nhelp==1 ? "" : "s");
\r
74 proutn("You have ");
\r
75 if (nprobes) proutn("%d", nprobes);
\r
77 proutn(" deep space probe");
\r
78 if (nprobes!=1) proutn("s");
\r
81 if ((game.damage[DRADIO] == 0.0 || condit == IHDOCKED)&&
\r
82 game.future[FDSPROB] != 1e30) {
\r
84 proutn("An armed deep space probe is in");
\r
86 proutn("A deep space probe is in");
\r
87 proutn(cramlc(quadrant, probecx, probecy));
\r
92 prout("Dilithium crystals aboard ship...not yet used.");
\r
96 while (cryprob > ai) {
\r
100 prout("Dilithium crystals have been used %d time%s.",
\r
101 i, i==1? "" : "s");
\r
107 void lrscan(void) {
\r
110 if (game.damage[DLRSENS] != 0.0) {
\r
111 /* Now allow base's sensors if docked */
\r
112 if (condit != IHDOCKED) {
\r
113 prout("LONG-RANGE SENSORS DAMAGED.");
\r
117 proutn("Starbase's long-range scan for");
\r
121 proutn("Long-range scan for");
\r
123 prout(cramlc(quadrant, quadx, quady));
\r
124 for (x = quadx-1; x <= quadx+1; x++) {
\r
125 for (y = quady-1; y <= quady+1; y++) {
\r
126 if (x == 0 || x > 8 || y == 0 || y > 8)
\r
129 proutn("%5d", game.state.galaxy[x][y]);
\r
130 game.starch[x][y] = game.damage[DRADIO] > 0 ? game.state.galaxy[x][y]+1000 :1;
\r
138 void dreprt(void) {
\r
139 int jdam = FALSE, i;
\r
142 for (i = 1; i <= NDEVICES; i++) {
\r
143 if (game.damage[i] > 0.0) {
\r
146 prout("DEVICE -REPAIR TIMES-");
\r
147 prout(" IN FLIGHT DOCKED");
\r
150 prout(" %16s %8.2f %8.2f",
\r
152 game.damage[i]+0.05,
\r
153 docfac*game.damage[i]+0.005);
\r
156 if (!jdam) prout("All devices functional.");
\r
159 void chart(int nn) {
\r
164 if (stdamtim != 1e30 && stdamtim != game.state.date && condit == IHDOCKED) {
\r
165 prout("Spock- \"I revised the Star Chart from the");
\r
166 prout(" starbase's records.\"");
\r
169 if (nn == 0) prout("STAR CHART FOR THE KNOWN GALAXY");
\r
170 if (stdamtim != 1e30) {
\r
171 if (condit == IHDOCKED) {
\r
172 /* We are docked, so restore chart from base information */
\r
173 stdamtim = game.state.date;
\r
174 for (i=1; i <= 8 ; i++)
\r
175 for (j=1; j <= 8; j++)
\r
176 if (game.starch[i][j] == 1) game.starch[i][j] = game.state.galaxy[i][j]+1000;
\r
179 proutn("(Last surveillance update %d stardates ago.",
\r
180 (int)(game.state.date-stdamtim));
\r
183 if (nn ==0) skip(1);
\r
185 prout(" 1 2 3 4 5 6 7 8");
\r
186 prout(" ----------------------------------------");
\r
187 /* if (nn==0) prout(" -"); */
\r
188 for (i = 1; i <= 8; i++) {
\r
190 for (j = 1; j <= 8; j++) {
\r
191 if (game.starch[i][j] < 0)
\r
193 else if (game.starch[i][j] == 0)
\r
195 else if (game.starch[i][j] > 999)
\r
196 proutn("%5d", game.starch[i][j]-1000);
\r
198 proutn("%5d", game.state.galaxy[i][j]);
\r
205 prout(" is currently in %s", cramlc(quadrant, quadx, quady));
\r
210 void srscan(int l) {
\r
211 static char requests[][3] =
\r
212 {"","da","co","po","ls","wa","en","to","sh","kl","ti"};
\r
214 int leftside=TRUE, rightside=TRUE, i, j, jj, k=0, nn=FALSE;
\r
218 if (game.damage[DSRSENS] != 0) {
\r
219 /* Allow base's sensors if docked */
\r
220 if (condit != IHDOCKED) {
\r
221 prout("SHORT-RANGE SENSORS DAMAGED");
\r
225 prout("[Using starbase's sensors]");
\r
228 game.starch[quadx][quady] = game.damage[DRADIO]>0.0 ?
\r
229 game.state.galaxy[quadx][quady]+1000:1;
\r
231 if (isit("chart")) nn = TRUE;
\r
232 if (isit("no")) rightside = FALSE;
\r
234 prout("\n 1 2 3 4 5 6 7 8 9 10");
\r
237 while (scan() == IHEOL)
\r
238 proutn("Information desired? ");
\r
240 for (k = 1; k <= 10; k++)
\r
241 if (strncmp(citem,requests[k],min(2,strlen(citem)))==0)
\r
244 prout("UNRECOGNIZED REQUEST. Legal requests are:\n"
\r
245 " date, condition, position, lsupport, warpfactor,\n"
\r
246 " energy, torpedoes, shields, klingons, time.");
\r
255 for (i = 1; i <= 10; i++) {
\r
256 int jj = (k!=0 ? k : i);
\r
259 for (j = 1; j <= 10; j++) {
\r
260 if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1))
\r
261 proutn("%c ",game.quad[i][j]);
\r
269 proutn(" Stardate %.1f", game.state.date);
\r
272 if (condit != IHDOCKED) newcnd();
\r
274 case IHRED: cp = "RED"; break;
\r
275 case IHGREEN: cp = "GREEN"; break;
\r
276 case IHYELLOW: cp = "YELLOW"; break;
\r
277 case IHDOCKED: cp = "DOCKED"; break;
\r
279 proutn(" Condition %s", cp);
\r
282 proutn(" Position ");
\r
283 proutn(cramlc(neither, quadx, quady));
\r
285 proutn(cramlc(neither, sectx, secty));
\r
288 proutn(" Life Support ");
\r
289 if (game.damage[DLIFSUP] != 0.0) {
\r
290 if (condit == IHDOCKED)
\r
291 proutn("DAMAGED, supported by starbase");
\r
293 proutn("DAMAGED, reserves=%.2f", lsupres);
\r
299 proutn(" Warp Factor %.1f", warpfac);
\r
302 proutn(" Energy %.2f", energy);
\r
305 proutn(" Torpedoes %d", torps);
\r
308 proutn(" Shields ");
\r
309 if (game.damage[DSHIELD] != 0)
\r
310 proutn("DAMAGED,");
\r
315 proutn(" %d%% %.1f units",
\r
316 (int)((100.0*shield)/inshld + 0.5), shield);
\r
319 proutn(" Klingons Left %d", game.state.remkl);
\r
322 proutn(" Time Left %.2f", game.state.remtime);
\r
335 int key, ix1, ix2, iy1, iy2, prompt=FALSE;
\r
337 double ttime, twarp, tpower;
\r
338 if (game.damage[DCOMPTR] != 0.0) {
\r
339 prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR.");
\r
343 if (scan() != IHREAL) {
\r
346 proutn("Destination quadrant and/or sector? ");
\r
347 if (scan()!=IHREAL) {
\r
353 if (scan() != IHREAL) {
\r
357 ix1 = aaitem + 0.5;
\r
358 if (scan() == IHREAL) {
\r
359 iy2 = aaitem + 0.5;
\r
360 if (scan() != IHREAL) {
\r
364 ix2 = aaitem + 0.5;
\r
366 else { // same quadrant
\r
369 ix1 = quady; // ya got me why x and y are reversed!
\r
373 if (ix1 > 8 || ix1 < 1 || iy1 > 8 || iy1 < 1 ||
\r
374 ix2 > 10 || ix2 < 1 || iy2 > 10 || iy2 < 1) {
\r
378 dist = sqrt(square(iy1-quadx+0.1*(iy2-sectx))+
\r
379 square(ix1-quady+0.1*(ix2-secty)));
\r
382 if (prompt) prout("Answer \"no\" if you don't know the value:");
\r
385 proutn("Time or arrival date? ");
\r
386 if (scan()==IHREAL) {
\r
388 if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date
\r
389 if (ttime <= 1e-10 ||
\r
390 (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) {
\r
391 prout("We'll never make it, sir.");
\r
395 if (twarp < 1.0) twarp = 1.0;
\r
399 proutn("Warp factor? ");
\r
400 if (scan()== IHREAL) {
\r
403 if (twarp<1.0 || twarp > 10.0) {
\r
409 prout("Captain, certainly you can give me one of these.");
\r
413 ttime = (10.0*dist)/square(twarp);
\r
414 tpower = dist*twarp*twarp*twarp*(shldup+1);
\r
415 if (tpower >= energy) {
\r
416 prout("Insufficient energy, sir.");
\r
417 if (shldup==0 || tpower > energy*2.0) {
\r
419 proutn("New warp factor to try? ");
\r
420 if (scan() == IHREAL) {
\r
423 if (twarp<1.0 || twarp > 10.0) {
\r
435 prout("But if you lower your shields,");
\r
436 proutn("remaining");
\r
440 proutn("Remaining");
\r
441 prout(" energy will be %.2f.", energy-tpower);
\r
443 prout("And we will arrive at stardate %.2f.",
\r
444 game.state.date+ttime);
\r
446 else if (twarp==1.0)
\r
447 prout("Any warp speed is adequate.");
\r
449 prout("Minimum warp needed is %.2f,", twarp);
\r
450 prout("and we will arrive at stardate %.2f.",
\r
451 game.state.date+ttime);
\r
453 if (game.state.remtime < ttime)
\r
454 prout("Unfortunately, the Federation will be destroyed by then.");
\r
456 prout("You'll be taking risks at that speed, Captain");
\r
457 if ((isatb==1 && game.state.isy == ix1 && game.state.isx == iy1 &&
\r
458 game.future[FSCDBAS]< ttime+game.state.date)||
\r
459 (game.future[FCDBAS]<ttime+game.state.date && baty==ix1 && batx == iy1))
\r
460 prout("The starbase there will be destroyed by then.");
\r
461 proutn("New warp factor to try? ");
\r
462 if (scan() == IHREAL) {
\r
465 if (twarp<1.0 || twarp > 10.0) {
\r