6 void attakreport(bool curt)
7 /* report status of bases under attack */
10 if (is_scheduled(FCDBAS)) {
11 prout(_("Starbase in %s is currently under Commander attack."),
12 cramlc(quadrant, game.battle));
13 prout(_("It can hold out until Stardate %d."),
14 (int)scheduled(FCDBAS));
16 if (game.isatb == 1) {
17 prout(_("Starbase in %s is under Super-commander attack."),
18 cramlc(quadrant, game.state.kscmdr));
19 prout(_("It can hold out until Stardate %d."),
20 (int)scheduled(FSCDBAS));
23 if (is_scheduled(FCDBAS))
24 proutn(_("Base in %i - %i attacked by C. Alive until %.1f"), game.battle.x, game.battle.y, scheduled(FCDBAS));
26 proutn(_("Base in %i - %i attacked by S. Alive until %.1f"), game.state.kscmdr.x, game.state.kscmdr.y, scheduled(FSCDBAS));
33 /* report on general game status */
38 s1 = (game.thawed?"thawed ":"");
39 switch (game.length) {
40 case 1: s2="short"; break;
41 case 2: s2="medium"; break;
42 case 4: s2="long"; break;
43 default: s2="unknown length"; break;
46 case SKILL_NOVICE: s3="novice"; break;
47 case SKILL_FAIR: s3="fair"; break;
48 case SKILL_GOOD: s3="good"; break;
49 case SKILL_EXPERT: s3="expert"; break;
50 case SKILL_EMERITUS: s3="emeritus"; break;
51 default: s3="skilled"; break;
54 prout(_("You %s playing a %s%s %s game."),
55 game.alldone? _("were") : _("are now"), s1, s2, s3);
56 if (game.skill>SKILL_GOOD && game.thawed && !game.alldone) prout(_("No plaque is allowed."));
57 if (game.tourn) prout(_("This is tournament game %d."), game.tourn);
58 prout(_("Your secret password is \"%s\""),game.passwd);
59 proutn(_("%d of %d Klingons have been killed"), KLINGKILLED, INKLINGTOT);
60 if (NKILLC) prout(_(", including %d Commander%s."), NKILLC, NKILLC==1?"":_("s"));
61 else if (NKILLK + NKILLSC > 0) prout(_(", but no Commanders."));
63 if (game.skill > SKILL_FAIR) prout(_("The Super Commander has %sbeen destroyed."),
64 game.state.nscrem?_("not "):"");
65 if (game.state.rembase != game.inbase) {
67 if (game.inbase-game.state.rembase==1) proutn(_("has been 1 base"));
69 proutn(_("have been %d bases"), game.inbase-game.state.rembase);
71 prout(_(" destroyed, %d remaining."), game.state.rembase);
73 else prout(_("There are %d bases."), game.inbase);
74 if (!damaged(DRADIO) || game.condit == IHDOCKED || game.iseenit) {
75 /* Don't report this if not seen and
76 either the radio is dead or not at base! */
80 if (game.casual) prout(_("%d casualt%s suffered so far."),
81 game.casual, game.casual==1? "y" : "ies");
82 if (game.nhelp) prout(_("There were %d call%s for help."),
83 game.nhelp, game.nhelp==1 ? "" : _("s"));
84 if (game.ship == IHE) {
85 proutn(_("You have "));
86 if (game.nprobes) proutn("%d", game.nprobes);
88 proutn(_(" deep space probe"));
89 if (game.nprobes!=1) proutn(_("s"));
92 if ((!damaged(DRADIO) || game.condit == IHDOCKED)
93 && is_scheduled(FDSPROB)) {
95 proutn(_("An armed deep space probe is in"));
97 proutn(_("A deep space probe is in"));
98 proutn(cramlc(quadrant, game.probec));
102 if (game.cryprob <= .05)
103 prout(_("Dilithium crystals aboard ship... not yet used."));
107 while (game.cryprob > ai) {
111 prout(_("Dilithium crystals have been used %d time%s."),
112 i, i==1? "" : _("s"));
119 /* long-range sensor scan */
123 if (damaged(DLRSENS)) {
124 /* Now allow base's sensors if docked */
125 if (game.condit != IHDOCKED) {
126 prout(_("LONG-RANGE SENSORS DAMAGED."));
129 prout(_("Starbase's long-range scan"));
132 prout(_("Long-range scan"));
134 for (x = game.quadrant.x-1; x <= game.quadrant.x+1; x++) {
136 for (y = game.quadrant.y-1; y <= game.quadrant.y+1; y++) {
137 if (!VALID_QUADRANT(x, y))
140 if (!damaged(DRADIO))
141 game.state.galaxy[x][y].charted = true;
142 game.state.chart[x][y].klingons = game.state.galaxy[x][y].klingons;
143 game.state.chart[x][y].starbase = game.state.galaxy[x][y].starbase;
144 game.state.chart[x][y].stars = game.state.galaxy[x][y].stars;
145 if (game.state.galaxy[x][y].supernova)
148 proutn(" %3d", game.state.chart[x][y].klingons*100 + game.state.chart[x][y].starbase * 10 + game.state.chart[x][y].stars);
162 for (i = 0; i < NDEVICES; i++) {
165 prout(_("DEVICE -REPAIR TIMES-"));
166 prout(_(" IN FLIGHT DOCKED"));
169 prout(" %16s %8.2f %8.2f",
172 game.docfac*game.damage[i]+0.005);
175 if (!jdam) prout(_("All devices functional."));
179 /* update the chart in the Enterprise's computer from galaxy data */
182 game.lastchart = game.state.date;
185 if (game.state.galaxy[i][j].charted) {
186 game.state.chart[i][j].klingons = game.state.galaxy[i][j].klingons;
187 game.state.chart[i][j].starbase = game.state.galaxy[i][j].starbase;
188 game.state.chart[i][j].stars = game.state.galaxy[i][j].stars;
192 void chart(bool title)
193 /* display the star chart */
198 if (!damaged(DRADIO))
201 if (game.lastchart < game.state.date && game.condit == IHDOCKED) {
202 prout(_("Spock- \"I revised the Star Chart from the starbase's records.\""));
206 if (!title) prout(_(" STAR CHART FOR THE KNOWN GALAXY"));
207 if (game.state.date > game.lastchart)
208 prout(_("(Last surveillance update %d stardates ago)."),
209 (int)(game.state.date-game.lastchart));
210 prout(" 1 2 3 4 5 6 7 8");
215 if ((game.options & OPTION_SHOWME) && i == game.quadrant.x && j == game.quadrant.y)
219 if (game.state.galaxy[i][j].supernova)
221 else if (!game.state.galaxy[i][j].charted && game.state.galaxy[i][j].starbase)
223 else if (game.state.galaxy[i][j].charted)
224 sprintf(buf, "%3d", game.state.chart[i][j].klingons*100 + game.state.chart[i][j].starbase * 10 + game.state.chart[i][j].stars);
228 if ((game.options & OPTION_SHOWME) && i == game.quadrant.x && j == game.quadrant.y)
234 if (i<GALSIZE) skip(1);
239 static void sectscan(int goodScan, int i, int j)
240 /* light up an individual dot in a sector */
242 if (goodScan || (abs(i-game.sector.x)<= 1 && abs(j-game.sector.y) <= 1)){
243 if ((game.quad[i][j]==IHMATER0)||(game.quad[i][j]==IHMATER1)||(game.quad[i][j]==IHMATER2)||(game.quad[i][j]==IHE)||(game.quad[i][j]==IHF)){
244 switch (game.condit) {
245 case IHRED: textcolor(RED); break;
246 case IHGREEN: textcolor(GREEN); break;
247 case IHYELLOW: textcolor(YELLOW); break;
248 case IHDOCKED: textcolor(CYAN); break;
249 case IHDEAD: textcolor(BROWN);
251 if (game.quad[i][j] != game.ship)
254 proutn("%c ",game.quad[i][j]);
261 static void status(int req)
262 /* print status report lines */
268 proutn(_("Stardate %.1f, Time Left %.2f"), game.state.date, game.state.remtime);
271 if (game.condit != IHDOCKED) newcnd();
272 switch (game.condit) {
273 case IHRED: cp = "RED"; break;
274 case IHGREEN: cp = "GREEN"; break;
275 case IHYELLOW: cp = "YELLOW"; break;
276 case IHDOCKED: cp = "DOCKED"; break;
277 case IHDEAD: cp="DEAD"; break;
279 for (t=0;t<NDEVICES;t++)
280 if (game.damage[t]>0)
282 proutn(_("Condition %s, %i DAMAGES"), cp, dam);
285 proutn(_("Position %d - %d , %d - %d"),
286 game.quadrant.x, game.quadrant.y, game.sector.x, game.sector.y);
289 proutn(_("Life Support "));
290 if (damaged(DLIFSUP)) {
291 if (game.condit == IHDOCKED)
292 proutn(_("DAMAGED, Base provides"));
294 proutn(_("DAMAGED, reserves=%4.2f"), game.lsupres);
300 proutn(_("Warp Factor %.1f"), game.warpfac);
303 proutn(_("Energy %.2f"), game.energy);
304 if (game.icrystl && (game.options & OPTION_SHOWME)) /* ESR */
305 proutn(_(" (have crystals)"));
308 proutn(_("Torpedoes %d"), game.torps);
311 proutn(_("Shields "));
312 if (damaged(DSHIELD))
313 proutn(_("DAMAGED,"));
314 else if (game.shldup)
318 proutn(_(" %d%% %.1f units"),
319 (int)((100.0*game.shield)/game.inshld + 0.5), game.shield);
322 proutn(_("Klingons Left %d"), KLINGREM);
325 if (game.options & OPTION_WORLDS) {
326 int here = game.state.galaxy[game.quadrant.x][game.quadrant.y].planet;
327 if (here != NOPLANET && game.state.plnets[here].inhabited != UNINHABITED)
328 proutn(_("Major system %s"), systemname(here));
330 proutn(_("Sector is uninhabited"));
341 /* short-range scan */
343 /* the "sy" request is undocumented */
344 static char requests[][3] =
345 {"","da","co","po","ls","wa","en","to","sh","kl","sy", "ti"};
348 int goodScan=true, leftside=true, rightside=true, title=false;
350 case SCAN_FULL: // SRSCAN
351 if (damaged(DSRSENS)) {
352 /* Allow base's sensors if docked */
353 if (game.condit != IHDOCKED) {
354 prout(_(" S.R. SENSORS DAMAGED!"));
358 prout(_(" [Using Base's sensors]"));
360 else prout(_(" Short-range scan"));
361 if (goodScan && !damaged(DRADIO)) {
362 game.state.chart[game.quadrant.x][game.quadrant.y].klingons = game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons;
363 game.state.chart[game.quadrant.x][game.quadrant.y].starbase = game.state.galaxy[game.quadrant.x][game.quadrant.y].starbase;
364 game.state.chart[game.quadrant.x][game.quadrant.y].stars = game.state.galaxy[game.quadrant.x][game.quadrant.y].stars;
365 game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = true;
368 if (isit("chart")) title = true;
369 if (isit("no")) rightside = false;
371 prout(" 1 2 3 4 5 6 7 8 9 10");
374 while (scan() == IHEOL)
375 proutn(_("Information desired? "));
377 for (req = 1; req <= sizeof(requests)/sizeof(requests[0]); req++)
378 if (strncmp(citem,requests[req],min(2,strlen(citem)))==0)
380 if (req > sizeof(requests)/sizeof(requests[0])) {
381 prout(_("UNRECOGNIZED REQUEST. Legal requests are:"));
382 prout(_(" date, condition, position, lsupport, warpfactor,"));
383 prout(_(" energy, torpedoes, shields, klingons, time, system, bases."));
387 case SCAN_STATUS: // STATUS
392 case SCAN_NO_LEFTSIDE: // REQUEST
396 if (game.condit != IHDOCKED) newcnd();
397 for (i = 1; i <= max(QUADSIZE, sizeof(requests)/sizeof(requests[0])); i++) {
398 jj = (req!=0 ? req : i);
399 if (leftside && i <= QUADSIZE) {
402 sectscan(goodScan, i, j);
407 if (i<sizeof(requests)/sizeof(requests[0])) skip(1);
408 if (req!=0) return(goodScan);
411 if (title) chart(true);
417 /* use computer to get estimated time of arrival for a warp jump */
419 int ix1, ix2, iy1, iy2;
420 bool wfl, prompt = false;
421 double ttime, twarp, tpower;
422 if (damaged(DCOMPTR)) {
423 prout(_("COMPUTER DAMAGED, USE A POCKET CALCULATOR."));
427 if (scan() != IHREAL) {
430 proutn(_("Destination quadrant and/or sector? "));
431 if (scan()!=IHREAL) {
437 if (scan() != IHREAL) {
442 if (scan() == IHREAL) {
444 if (scan() != IHREAL) {
451 if (game.quadrant.y>ix1) ix2 = 1;
453 if (game.quadrant.x>iy1) iy2 = 1;
457 if (!VALID_QUADRANT(ix1, iy1) || !VALID_SECTOR(ix2, iy2)) {
461 game.dist = sqrt(square(iy1-game.quadrant.x+0.1*(iy2-game.sector.x))+
462 square(ix1-game.quadrant.y+0.1*(ix2-game.sector.y)));
465 if (prompt) prout(_("Answer \"no\" if you don't know the value:"));
468 proutn(_("Time or arrival date? "));
469 if (scan()==IHREAL) {
471 if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date
472 if (ttime <= 1e-10 ||
473 (twarp=(floor(sqrt((10.0*game.dist)/ttime)*10.0)+1.0)/10.0) > 10) {
474 prout(_("We'll never make it, sir."));
478 if (twarp < 1.0) twarp = 1.0;
482 proutn(_("Warp factor? "));
483 if (scan()== IHREAL) {
486 if (twarp<1.0 || twarp > 10.0) {
492 prout(_("Captain, certainly you can give me one of these."));
496 ttime = (10.0*game.dist)/square(twarp);
497 tpower = game.dist*twarp*twarp*twarp*(game.shldup+1);
498 if (tpower >= game.energy) {
499 prout(_("Insufficient energy, sir."));
500 if (!game.shldup || tpower > game.energy*2.0) {
502 proutn(_("New warp factor to try? "));
503 if (scan() == IHREAL) {
506 if (twarp<1.0 || twarp > 10.0) {
518 prout(_("But if you lower your shields,"));
519 proutn(_("remaining"));
523 proutn(_("Remaining"));
524 prout(_(" energy will be %.2f."), game.energy-tpower);
526 prout(_("And we will arrive at stardate %.2f."),
527 game.state.date+ttime);
530 prout(_("Any warp speed is adequate."));
532 prout(_("Minimum warp needed is %.2f,"), twarp);
533 prout(_("and we will arrive at stardate %.2f."),
534 game.state.date+ttime);
536 if (game.state.remtime < ttime)
537 prout(_("Unfortunately, the Federation will be destroyed by then."));
539 prout(_("You'll be taking risks at that speed, Captain"));
540 if ((game.isatb==1 && game.state.kscmdr.y == iy1 && game.state.kscmdr.x == ix1 &&
541 scheduled(FSCDBAS)< ttime+game.state.date)||
542 (scheduled(FCDBAS)<ttime+game.state.date && game.battle.y==iy1 && game.battle.x == ix1))
543 prout(_("The starbase there will be destroyed by then."));
544 proutn(_("New warp factor to try? "));
545 if (scan() == IHREAL) {
548 if (twarp<1.0 || twarp > 10.0) {