6 void attakreport(bool curt)
9 if (is_scheduled(FCDBAS)) {
10 prout(_("Starbase in %s is currently under Commander attack."),
11 cramlc(quadrant, game.battle));
12 prout(_("It can hold out until Stardate %d."),
13 (int)scheduled(FCDBAS));
15 if (game.isatb == 1) {
16 prout(_("Starbase in %s is under Super-commander attack."),
17 cramlc(quadrant, game.state.kscmdr));
18 prout(_("It can hold out until Stardate %d."),
19 (int)scheduled(FSCDBAS));
22 if (is_scheduled(FCDBAS))
23 proutn(_("Base in %i - %i attacked by C. Alive until %.1f"), game.battle.x, game.battle.y, scheduled(FCDBAS));
25 proutn(_("Base in %i - %i attacked by S. Alive until %.1f"), game.state.kscmdr.x, game.state.kscmdr.y, scheduled(FSCDBAS));
36 s1 = (game.thawed?"thawed ":"");
37 switch (game.length) {
38 case 1: s2="short"; break;
39 case 2: s2="medium"; break;
40 case 4: s2="long"; break;
41 default: s2="unknown length"; break;
44 case SKILL_NOVICE: s3="novice"; break;
45 case SKILL_FAIR: s3="fair"; break;
46 case SKILL_GOOD: s3="good"; break;
47 case SKILL_EXPERT: s3="expert"; break;
48 case SKILL_EMERITUS: s3="emeritus"; break;
49 default: s3="skilled"; break;
52 prout(_("You %s playing a %s%s %s game."),
53 game.alldone? _("were") : _("are now"), s1, s2, s3);
54 if (game.skill>SKILL_GOOD && game.thawed && !game.alldone) prout(_("No plaque is allowed."));
55 if (game.tourn) prout(_("This is tournament game %d."), game.tourn);
56 prout(_("Your secret password is \"%s\""),game.passwd);
57 proutn(_("%d of %d Klingons have been killed"), KLINGKILLED, INKLINGTOT);
58 if (NKILLC) prout(_(", including %d Commander%s."), NKILLC, NKILLC==1?"":_("s"));
59 else if (NKILLK + NKILLSC > 0) prout(_(", but no Commanders."));
61 if (game.skill > SKILL_FAIR) prout(_("The Super Commander has %sbeen destroyed."),
62 game.state.nscrem?_("not "):"");
63 if (game.state.rembase != game.inbase) {
65 if (game.inbase-game.state.rembase==1) proutn(_("has been 1 base"));
67 proutn(_("have been %d bases"), game.inbase-game.state.rembase);
69 prout(_(" destroyed, %d remaining."), game.state.rembase);
71 else prout(_("There are %d bases."), game.inbase);
72 if (!damaged(DRADIO) || game.condit == IHDOCKED || game.iseenit) {
73 /* Don't report this if not seen and
74 either the radio is dead or not at base! */
78 if (game.casual) prout(_("%d casualt%s suffered so far."),
79 game.casual, game.casual==1? "y" : "ies");
80 if (game.nhelp) prout(_("There were %d call%s for help."),
81 game.nhelp, game.nhelp==1 ? "" : _("s"));
82 if (game.ship == IHE) {
83 proutn(_("You have "));
84 if (game.nprobes) proutn("%d", game.nprobes);
86 proutn(_(" deep space probe"));
87 if (game.nprobes!=1) proutn(_("s"));
90 if ((!damaged(DRADIO) || game.condit == IHDOCKED)
91 && is_scheduled(FDSPROB)) {
93 proutn(_("An armed deep space probe is in"));
95 proutn(_("A deep space probe is in"));
96 proutn(cramlc(quadrant, game.probec));
100 if (game.cryprob <= .05)
101 prout(_("Dilithium crystals aboard ship... not yet used."));
105 while (game.cryprob > ai) {
109 prout(_("Dilithium crystals have been used %d time%s."),
110 i, i==1? "" : _("s"));
120 if (damaged(DLRSENS)) {
121 /* Now allow base's sensors if docked */
122 if (game.condit != IHDOCKED) {
123 prout(_("LONG-RANGE SENSORS DAMAGED."));
126 prout(_("Starbase's long-range scan"));
129 prout(_("Long-range scan"));
131 for (x = game.quadrant.x-1; x <= game.quadrant.x+1; x++) {
133 for (y = game.quadrant.y-1; y <= game.quadrant.y+1; y++) {
134 if (!VALID_QUADRANT(x, y))
137 if (!damaged(DRADIO))
138 game.state.galaxy[x][y].charted = true;
139 game.state.chart[x][y].klingons = game.state.galaxy[x][y].klingons;
140 game.state.chart[x][y].starbase = game.state.galaxy[x][y].starbase;
141 game.state.chart[x][y].stars = game.state.galaxy[x][y].stars;
142 if (game.state.galaxy[x][y].supernova)
145 proutn(" %3d", game.state.chart[x][y].klingons*100 + game.state.chart[x][y].starbase * 10 + game.state.chart[x][y].stars);
158 for (i = 0; i < NDEVICES; i++) {
161 prout(_("DEVICE -REPAIR TIMES-"));
162 prout(_(" IN FLIGHT DOCKED"));
165 prout(" %16s %8.2f %8.2f",
168 game.docfac*game.damage[i]+0.005);
171 if (!jdam) prout(_("All devices functional."));
175 /* update the chart in the Enterprise's computer from galaxy data */
178 game.lastchart = game.state.date;
181 if (game.state.galaxy[i][j].charted) {
182 game.state.chart[i][j].klingons = game.state.galaxy[i][j].klingons;
183 game.state.chart[i][j].starbase = game.state.galaxy[i][j].starbase;
184 game.state.chart[i][j].stars = game.state.galaxy[i][j].stars;
188 void chart(bool title)
193 if (!damaged(DRADIO))
196 if (game.lastchart < game.state.date && game.condit == IHDOCKED) {
197 prout(_("Spock- \"I revised the Star Chart from the starbase's records.\""));
201 if (!title) prout(_(" STAR CHART FOR THE KNOWN GALAXY"));
202 if (game.state.date > game.lastchart)
203 prout(_("(Last surveillance update %d stardates ago)."),
204 (int)(game.state.date-game.lastchart));
205 prout(" 1 2 3 4 5 6 7 8");
210 if ((game.options & OPTION_SHOWME) && i == game.quadrant.x && j == game.quadrant.y)
214 if (game.state.galaxy[i][j].supernova)
216 else if (!game.state.galaxy[i][j].charted && game.state.galaxy[i][j].starbase)
218 else if (game.state.galaxy[i][j].charted)
219 sprintf(buf, "%3d", game.state.chart[i][j].klingons*100 + game.state.chart[i][j].starbase * 10 + game.state.chart[i][j].stars);
223 if ((game.options & OPTION_SHOWME) && i == game.quadrant.x && j == game.quadrant.y)
229 if (i<GALSIZE) skip(1);
234 static void sectscan(int goodScan, int i, int j)
236 if (goodScan || (abs(i-game.sector.x)<= 1 && abs(j-game.sector.y) <= 1)){
237 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)){
238 switch (game.condit) {
239 case IHRED: textcolor(RED); break;
240 case IHGREEN: textcolor(GREEN); break;
241 case IHYELLOW: textcolor(YELLOW); break;
242 case IHDOCKED: textcolor(CYAN); break;
243 case IHDEAD: textcolor(BROWN);
245 if (game.quad[i][j] != game.ship)
248 proutn("%c ",game.quad[i][j]);
255 static void status(int req)
261 proutn(_("Stardate %.1f, Time Left %.2f"), game.state.date, game.state.remtime);
264 if (game.condit != IHDOCKED) newcnd();
265 switch (game.condit) {
266 case IHRED: cp = "RED"; break;
267 case IHGREEN: cp = "GREEN"; break;
268 case IHYELLOW: cp = "YELLOW"; break;
269 case IHDOCKED: cp = "DOCKED"; break;
270 case IHDEAD: cp="DEAD"; break;
272 for (t=0;t<NDEVICES;t++)
273 if (game.damage[t]>0)
275 proutn(_("Condition %s, %i DAMAGES"), cp, dam);
278 proutn(_("Position %d - %d , %d - %d"),
279 game.quadrant.x, game.quadrant.y, game.sector.x, game.sector.y);
282 proutn(_("Life Support "));
283 if (damaged(DLIFSUP)) {
284 if (game.condit == IHDOCKED)
285 proutn(_("DAMAGED, Base provides"));
287 proutn(_("DAMAGED, reserves=%4.2f"), game.lsupres);
293 proutn(_("Warp Factor %.1f"), game.warpfac);
296 proutn(_("Energy %.2f"), game.energy);
297 if (game.icrystl && (game.options & OPTION_SHOWME)) /* ESR */
298 proutn(_(" (have crystals)"));
301 proutn(_("Torpedoes %d"), game.torps);
304 proutn(_("Shields "));
305 if (damaged(DSHIELD))
306 proutn(_("DAMAGED,"));
307 else if (game.shldup)
311 proutn(_(" %d%% %.1f units"),
312 (int)((100.0*game.shield)/game.inshld + 0.5), game.shield);
315 proutn(_("Klingons Left %d"), KLINGREM);
318 if (game.options & OPTION_WORLDS) {
319 int here = game.state.galaxy[game.quadrant.x][game.quadrant.y].planet;
320 if (here != NOPLANET && game.state.plnets[here].inhabited != UNINHABITED)
321 proutn(_("Major system %s"), systemname(here));
323 proutn(_("Sector is uninhabited"));
335 /* the "sy" request is undocumented */
336 static char requests[][3] =
337 {"","da","co","po","ls","wa","en","to","sh","kl","sy", "ti"};
340 int goodScan=true, leftside=true, rightside=true, title=false;
342 case SCAN_FULL: // SRSCAN
343 if (damaged(DSRSENS)) {
344 /* Allow base's sensors if docked */
345 if (game.condit != IHDOCKED) {
346 prout(_(" S.R. SENSORS DAMAGED!"));
350 prout(_(" [Using Base's sensors]"));
352 else prout(_(" Short-range scan"));
353 if (goodScan && !damaged(DRADIO)) {
354 game.state.chart[game.quadrant.x][game.quadrant.y].klingons = game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons;
355 game.state.chart[game.quadrant.x][game.quadrant.y].starbase = game.state.galaxy[game.quadrant.x][game.quadrant.y].starbase;
356 game.state.chart[game.quadrant.x][game.quadrant.y].stars = game.state.galaxy[game.quadrant.x][game.quadrant.y].stars;
357 game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = true;
360 if (isit("chart")) title = true;
361 if (isit("no")) rightside = false;
363 prout(" 1 2 3 4 5 6 7 8 9 10");
366 while (scan() == IHEOL)
367 proutn(_("Information desired? "));
369 for (req = 1; req <= sizeof(requests)/sizeof(requests[0]); req++)
370 if (strncmp(citem,requests[req],min(2,strlen(citem)))==0)
372 if (req > sizeof(requests)/sizeof(requests[0])) {
373 prout(_("UNRECOGNIZED REQUEST. Legal requests are:"));
374 prout(_(" date, condition, position, lsupport, warpfactor,"));
375 prout(_(" energy, torpedoes, shields, klingons, time, system, bases."));
379 case SCAN_STATUS: // STATUS
384 case SCAN_NO_LEFTSIDE: // REQUEST
388 if (game.condit != IHDOCKED) newcnd();
389 for (i = 1; i <= max(QUADSIZE, sizeof(requests)/sizeof(requests[0])); i++) {
390 jj = (req!=0 ? req : i);
391 if (leftside && i <= QUADSIZE) {
394 sectscan(goodScan, i, j);
399 if (i<sizeof(requests)/sizeof(requests[0])) skip(1);
400 if (req!=0) return(goodScan);
403 if (title) chart(true);
410 int ix1, ix2, iy1, iy2;
411 bool wfl, prompt = false;
412 double ttime, twarp, tpower;
413 if (damaged(DCOMPTR)) {
414 prout(_("COMPUTER DAMAGED, USE A POCKET CALCULATOR."));
418 if (scan() != IHREAL) {
421 proutn(_("Destination quadrant and/or sector? "));
422 if (scan()!=IHREAL) {
428 if (scan() != IHREAL) {
433 if (scan() == IHREAL) {
435 if (scan() != IHREAL) {
442 if (game.quadrant.y>ix1) ix2 = 1;
444 if (game.quadrant.x>iy1) iy2 = 1;
448 if (!VALID_QUADRANT(ix1, iy1) || !VALID_SECTOR(ix2, iy2)) {
452 game.dist = sqrt(square(iy1-game.quadrant.x+0.1*(iy2-game.sector.x))+
453 square(ix1-game.quadrant.y+0.1*(ix2-game.sector.y)));
456 if (prompt) prout(_("Answer \"no\" if you don't know the value:"));
459 proutn(_("Time or arrival date? "));
460 if (scan()==IHREAL) {
462 if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date
463 if (ttime <= 1e-10 ||
464 (twarp=(floor(sqrt((10.0*game.dist)/ttime)*10.0)+1.0)/10.0) > 10) {
465 prout(_("We'll never make it, sir."));
469 if (twarp < 1.0) twarp = 1.0;
473 proutn(_("Warp factor? "));
474 if (scan()== IHREAL) {
477 if (twarp<1.0 || twarp > 10.0) {
483 prout(_("Captain, certainly you can give me one of these."));
487 ttime = (10.0*game.dist)/square(twarp);
488 tpower = game.dist*twarp*twarp*twarp*(game.shldup+1);
489 if (tpower >= game.energy) {
490 prout(_("Insufficient energy, sir."));
491 if (!game.shldup || tpower > game.energy*2.0) {
493 proutn(_("New warp factor to try? "));
494 if (scan() == IHREAL) {
497 if (twarp<1.0 || twarp > 10.0) {
509 prout(_("But if you lower your shields,"));
510 proutn(_("remaining"));
514 proutn(_("Remaining"));
515 prout(_(" energy will be %.2f."), game.energy-tpower);
517 prout(_("And we will arrive at stardate %.2f."),
518 game.state.date+ttime);
521 prout(_("Any warp speed is adequate."));
523 prout(_("Minimum warp needed is %.2f,"), twarp);
524 prout(_("and we will arrive at stardate %.2f."),
525 game.state.date+ttime);
527 if (game.state.remtime < ttime)
528 prout(_("Unfortunately, the Federation will be destroyed by then."));
530 prout(_("You'll be taking risks at that speed, Captain"));
531 if ((game.isatb==1 && game.state.kscmdr.y == iy1 && game.state.kscmdr.x == ix1 &&
532 scheduled(FSCDBAS)< ttime+game.state.date)||
533 (scheduled(FCDBAS)<ttime+game.state.date && game.battle.y==iy1 && game.battle.x == ix1))
534 prout(_("The starbase there will be destroyed by then."));
535 proutn(_("New warp factor to try? "));
536 if (scan() == IHREAL) {
539 if (twarp<1.0 || twarp > 10.0) {