1
0
kolibrios/programs/games/sstartrek/ru/reports.c

625 lines
18 KiB
C
Raw Normal View History

#include "sst.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
void attakreport(void) {
if (future[FCDBAS] < 1e30) {
proutn("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>");/*Starbase in*/
cramlc(1, batx, baty);
/* prout(" is currently under attack.");
proutn("It can hold out until Stardate ");
*/ prout(" <20><><EFBFBD><E5AEA4><EFBFBD><EFBFBD> <20><><EFBFBD> <20><EFBFBD><E2A0AA>.");
proutn("<EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><E0A6A8><EFBFBD> <20><><EFBFBD><EFBFBD><E1A8AC> <20><> ");
cramf(future[FCDBAS], 0,1);
prout(".");
}
if (isatb == 1) {
proutn("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>");/*Starbase in*/
cramlc(1, d.isx, d.isy);
/* prout(" is under Super-commander attack.");
proutn("It can hold out until Stardate ");
*/ prout(" <20><><EFBFBD><E5AEA4><EFBFBD><EFBFBD> <20><><EFBFBD> <20><EFBFBD><E2A0AA> <20><EFBFBD><E3AFA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
proutn("<EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><E0A6A8><EFBFBD> <20><><EFBFBD><EFBFBD><E1A8AC> <20><> ");
cramf(future[FSCDBAS], 0, 1);
prout(".");
}
}
void report(int f) {
char *s1,*s2,*s3;
chew();
s1 = (thawed?"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ":"");/*thawed*/
switch (length) {
case 1: s2="<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/short"; break;
case 2: s2="<EFBFBD><EFBFBD><EFBFBD><EFBFBD>/medium"; break;
case 4: s2="<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/long"; break;
default: s2="<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>⥫쭮<E2A5AB><ECADAE><EFBFBD>/unknown length"; break;
}
switch (skill) {
case SNOVICE: s3="<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; break;/*novice*/
case SFAIR: s3="<EFBFBD><EFBFBD><EFBFBD>"; break;/*fair*/
case SGOOD: s3="<EFBFBD>⫨筨<EFBFBD>"; break;/*good*/
case SEXPERT: s3="<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; break;/*expert*/
case SEMERITUS: s3="<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; break;/*emeritus*/
default: s3="<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; break;/*skilled*/
}
/* printf("\nYou %s playing a %s%s %s game.\n",
alldone? "were": "are now", s1, s2, s3);
*/ printf("\n<EFBFBD><EFBFBD> %s a %s%s <20><><EFBFBD><EFBFBD> <20><><><E1ABAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s.\n",
alldone? "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>": "<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0A0A5>", s1, s2, s3);
if (skill>SGOOD && thawed && !alldone) prout("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E2ABA8><EFBFBD> <20><> <20><EFBFBD><EBA4A0><EFBFBD><EFBFBD>.");/*No plaque is allowed*/
/* if (tourn) printf("This is tournament game %d.\n", tourn); */
if (tourn) printf("<EFBFBD><EFBFBD><EFBFBD> <20><><E0ADA8> <20><><EFBFBD><EFBFBD> %d.\n", tourn);
/* if (f) printf("Your secret password is \"%s\"\n",passwd); */
if (f) printf("<EFBFBD><EFBFBD><EFBFBD><><E1A5AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> \"%s\"\n",passwd);
/* printf("%d of %d Klingon ships have been destroyed", */
printf("%d <20><> %d <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0A0A1><EFBFBD><><EFBFBD><E2AEA6><EFBFBD>",
d.killk+d.killc+d.nsckill, inkling);
/* if (d.killc) printf(", including %d Commander%s.\n", d.killc, d.killc==1?"":"s"); */
if (d.killc) printf(", <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s.\n", d.killc, d.killc==1?"<EFBFBD>":"<EFBFBD><EFBFBD>");
else if (d.killk+d.nsckill > 0) prout(", <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");/*but no Commanders*/
else prout(".");
/* if (skill > SFAIR) printf("The Super Commander has %sbeen destroyed.\n",
d.nscrem?"not ":"");
*/ if (skill > SFAIR) printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s<><73><EFBFBD><><EFBFBD><E2AEA6>.\n",
d.nscrem?"<EFBFBD><EFBFBD> ":"");
if (d.rembase != inbase) {
/* proutn("There ");
if (inbase-d.rembase==1) proutn("has been 1 base");
else {
proutn("have been ");
crami(inbase-d.rembase, 1);
proutn(" bases");
}
proutn(" destroyed, ");
crami(d.rembase, 1);
prout(" remaining.");
*/
if (inbase-d.rembase==1) proutn("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E2A0AD><EFBFBD> <20>뫠 㭨<><EFBFBD><E2AEA6><EFBFBD>,");
else {
proutn("<EFBFBD>");
crami(inbase-d.rembase, 1);
proutn(" <20>⠭権 㭨<><EFBFBD><E2AEA6><EFBFBD>, ");
}
crami(d.rembase, 1);
prout(" <20><><EFBFBD><E2A0AB><EFBFBD>.");
}
else printf("<EFBFBD><EFBFBD> %d <20>⠭権.\n", inbase);/*There are %d bases*/
if (REPORTS || iseenit) {
/* Don't report this if not seen and
either the radio is dead or not at base! */
attakreport();
iseenit = 1;
}
/* if (casual) printf("%d casualt%s suffered so far.\n",
casual, casual==1? "y" : "ies");
*/ if (casual) printf("%d ᬥ<><E1ACA5>%s <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n",
casual, casual==1? "<EFBFBD>" : "<EFBFBD><EFBFBD>");
#ifdef CAPTURE
/* if (brigcapacity != brigfree) printf("%d Klingon%s in brig.\n",
brigcapacity-brigfree, brigcapacity-brigfree>1 ? "s" : "");
*/ if (brigcapacity != brigfree) printf("%d <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s <20><> <20><EFBFBD>.\n",
brigcapacity-brigfree, brigcapacity-brigfree>1 ? "<EFBFBD><EFBFBD>" : "");
/* if (kcaptured > 0) printf("%d captured Klingon%s turned in to Star Fleet.\n",
kcaptured, kcaptured>1 ? "s" : "");
*/ if (kcaptured > 0) printf("%d <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%s <20><><EFBFBD><EFBFBD><E1AEA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>.\n",
kcaptured, kcaptured>1 ? "<EFBFBD><EFBFBD>" : "");
#endif
/* if (nhelp) printf("There were %d call%s for help.\n",
nhelp, nhelp==1 ? "" : "s");
*/ if (nhelp) printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d <20><EFBFBD>%s <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n",
nhelp, nhelp==1 ? "" : "<EFBFBD><EFBFBD>");
if (ship == IHE) {
proutn("<EFBFBD> <20><><EFBFBD> <20><><EFBFBD><E2A0AB><EFBFBD> ");/**/
if (nprobes) crami(nprobes,1);
else proutn("0");/*no*/
proutn("<><E0A0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");/*deep space probe*/
if (nprobes!=1) proutn("<EFBFBD><EFBFBD>");/*s*/
prout(".");
}
if (REPORTS && future[FDSPROB] != 1e30) {
if (isarmed)
/* proutn("An armed deep space probe is in"); */
proutn("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뢠⥫<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><>");
else
proutn("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뢠⥫<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><>");/*A deep space probe is in*/
cramlc(1, probecx, probecy);
prout(".");
}
if (icrystl) {
if (cryprob <= .05)
/* prout("Dilithium crystals aboard ship...not yet used."); */
prout("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E2A0AB> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>...<2E><> <20><20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD>.");
else {
int i=0;
double ai = 0.05;
while (cryprob > ai) {
ai *= 2.0;
i++;
}
/* printf("Dilithium crystals have been used %d time%s.\n",
i, i==1? "" : "s");
*/ printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d ࠧ%s.\n",
i, (i>1 && i<5)? "<EFBFBD>" : "");
}
}
skip(1);
}
void lrscan(void) {
int x, y;
chew();
if (damage[DLRSENS] != 0.0) {
/* Now allow base's sensors if docked */
if (condit != IHDOCKED) {
/* prout("LONG-RANGE SENSORS DAMAGED."); */
prout("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
return;
}
skip(1);
/* proutn("Starbase's long-range scan for"); */
proutn("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>㥬 ᥭ<><E1A5AD><EFBFBD><EFBFBD> <20>⠭樨 <20><><EFBFBD>");
}
else {
skip(1);
/* proutn("Long-range scan for"); */
proutn("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><><E1AAA0><EFBFBD><E0AEA2><EFBFBD><EFBFBD> <20><><EFBFBD>");
}
cramlc(1, quadx, quady);
skip(1);
if (coordfixed)
for (y = quady+1; y >= quady-1; y--) {
for (x = quadx-1; x <= quadx+1; x++) {
if (x == 0 || x > 8 || y == 0 || y > 8)
printf(" -1");
else {
printf("%5d", d.galaxy[x][y]);
// If radio works, mark star chart so
// it will show current information.
// Otherwise mark with current
// value which is fixed.
starch[x][y] = damage[DRADIO] > 0 ? d.galaxy[x][y]+1000 :1;
}
}
putchar('\n');
}
else
for (x = quadx-1; x <= quadx+1; x++) {
for (y = quady-1; y <= quady+1; y++) {
if (x == 0 || x > 8 || y == 0 || y > 8)
printf(" -1");
else {
printf("%5d", d.galaxy[x][y]);
// If radio works, mark star chart so
// it will show current information.
// Otherwise mark with current
// value which is fixed.
starch[x][y] = damage[DRADIO] > 0 ? d.galaxy[x][y]+1000 :1;
}
}
putchar('\n');
}
}
void dreprt(void) {
int jdam = FALSE, i;
chew();
for (i = 1; i <= ndevice; i++) {
if (damage[i] > 0.0) {
if (!jdam) {
skip(1);
/* prout("DEVICE -REPAIR TIMES-");
prout(" IN FLIGHT DOCKED");
*/ prout("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -<2D><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-");
prout(" <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
jdam = TRUE;
}
printf(" %16s ", device[i]);
cramf(damage[i]+0.05, 8, 2);
proutn(" ");
cramf(docfac*damage[i]+0.005, 8, 2);
skip(1);
}
}
/* if (!jdam) prout("All devices functional."); */
if (!jdam) prout("<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E0A0A2>.");
}
void chart(int nn) {
int i,j;
chew();
skip(1);
if (stdamtim != 1e30 && stdamtim != d.date && condit == IHDOCKED) {
/* prout("Spock- \"I revised the Star Chart from the");
prout(" starbase's records.\"");
*/ prout("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>- \"<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>");
prout(" <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>⠭樨.\"");
skip(1);
}
/* if (nn == 0) prout("STAR CHART FOR THE KNOWN GALAXY"); */
if (nn == 0) prout("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
if (stdamtim != 1e30) {
if (condit == IHDOCKED) {
/* We are docked, so restore chart from base information -- these values won't update! */
stdamtim = d.date;
for (i=1; i <= 8 ; i++)
for (j=1; j <= 8; j++)
if (starch[i][j] == 1) starch[i][j] = d.galaxy[i][j]+1000;
}
else {
proutn("(<28><><EFBFBD><E1ABA5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ");/*Last surveillance update*/
cramf(d.date-stdamtim, 0, 1);
prout(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>.)");/*stardates ago*/
}
}
if (nn ==0) skip(1);
prout(" 1 2 3 4 5 6 7 8");
prout(" ----------------------------------------");
if (nn==0) prout(" -");
if (coordfixed)
for (j = 8; j >= 1; j--) {
printf("%d -", j);
for (i = 1; i <= 8; i++) {
if (starch[i][j] < 0) // We know only about the bases
printf(" .1.");
else if (starch[i][j] == 0) // Unknown
printf(" ...");
else if (starch[i][j] > 999) // Memorized value
printf("%5d", starch[i][j]-1000);
else
printf("%5d", d.galaxy[i][j]); // What is actually there (happens when value is 1)
}
prout(" -");
}
else
for (i = 1; i <= 8; i++) {
printf("%d -", i);
for (j = 1; j <= 8; j++) {
if (starch[i][j] < 0) // We know only about the bases
printf(" .1.");
else if (starch[i][j] == 0) // Unknown
printf(" ...");
else if (starch[i][j] > 999) // Memorized value
printf("%5d", starch[i][j]-1000);
else
printf("%5d", d.galaxy[i][j]); // What is actually there (happens when value is 1)
}
prout(" -");
}
if (nn == 0) {
skip(1);
crmshp();
proutn(" <20><><EFBFBD><E5AEA4><EFBFBD><EFBFBD> <20> <20><>");/*is currently in*/
cramlc(1, quadx, quady);
skip(1);
}
}
void srscan(int l) {
static char requests[][3] =
{"","da","co","po","ls","wa","en","to","sh","kl","ti"};
char *cp;
int leftside=TRUE, rightside=TRUE, i, j, jj, k=0, nn=FALSE;
int goodScan=TRUE;
switch (l) {
case 1: // SRSCAN
if (damage[DSRSENS] != 0) {
/* Allow base's sensors if docked */
if (condit != IHDOCKED) {
/* prout("SHORT-RANGE SENSORS DAMAGED"); */
prout("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
goodScan=FALSE;
}
else
/* prout("[Using starbase's sensors]"); */
prout("[<5B><EFBFBD><E1AFAE><EFBFBD>㥬 ᥭ<><E1A5AD><EFBFBD><EFBFBD> <20>⠭樨]");
}
if (goodScan)
starch[quadx][quady] = damage[DRADIO]>0.0 ?
d.galaxy[quadx][quady]+1000:1;
scan();
if (isit("chart")) nn = TRUE;
if (isit("no")) rightside = FALSE;
chew();
prout("\n 1 2 3 4 5 6 7 8 9 10");
break;
case 2: // REQUEST
while (scan() == IHEOL)
/* printf("Information desired? "); */
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0ACA0><EFBFBD>? ");
chew();
for (k = 1; k <= 10; k++)
if (strncmp(citem,requests[k],min(2,strlen(citem)))==0)
break;
if (k > 10) {
/* prout("UNRECOGNIZED REQUEST. Legal requests are:\n"
" date, condition, position, lsupport, warpfactor,\n"
" energy, torpedoes, shields, klingons, time.");
*/ prout("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><E0A5AA><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD> <20><EFBFBD>):\n"
" date(<28><><EFBFBD><EFBFBD>), condition(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>), position(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>),\n"
" lsupport (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᯥ祭<E1AFA5><E7A5AD>), warpfactor (<28><><EFBFBD><EFBFBD>-䠪<><E4A0AA><EFBFBD>),\n"
" energy(<28><><EFBFBD><EFBFBD>), torpedoes(<28><><EFBFBD><E0AFA5>), shields (ᨫ<><E1A8AB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>),\n"
" klingons(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>), time(<28><EFBFBD>).");
return;
}
// no "break"
case 3: // STATUS
chew();
leftside = FALSE;
skip(1);
}
for (i = 1; i <= 10; i++) {
int jj = (k!=0 ? k : i);
if (leftside) {
if (coordfixed) {
printf("%2d ", 11-i);
for (j = 1; j <= 10; j++) {
if (goodScan || (abs((11-i)-secty)<= 1 && abs(j-sectx) <= 1))
printf("%c ",quad[j][11-i]);
else
printf("- ");
}
} else {
printf("%2d ", i);
for (j = 1; j <= 10; j++) {
if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1))
printf("%c ",quad[i][j]);
else
printf("- ");
}
}
}
if (rightside) {
switch (jj) {
case 1:
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> %.1f", d.date);/*Stardate*/
break;
case 2:
if (condit != IHDOCKED) newcnd();
switch (condit) {
case IHRED: cp = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; break;/*RED*/
case IHGREEN: cp = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; break;/*GREEN*/
case IHYELLOW: cp = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; break;/*YELLOW*/
case IHDOCKED: cp = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; break;/*DOCKED*/
}
/* printf(" Condition %s", cp); */
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s", cp);
#ifdef CLOAKING
if (iscloaked) printf(", <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");/*CLOAKED*/
#endif
break;
case 3:
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ");/*Position*/
cramlc(0, quadx, quady);
putchar(',');
cramlc(0, sectx, secty);
break;
case 4:
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᯥ祭<E1AFA5><E7A5AD> ");/*Life Support*/
if (damage[DLIFSUP] != 0.0) {
if (condit == IHDOCKED)
/* printf("DAMAGED, supported by starbase");
else
printf("DAMAGED, reserves=%4.2f", lsupres);
*/ printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><E2A0A5><EFBFBD> <20><> <20>⠭樨");
else
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, १<><E0A5A7><EFBFBD>=%4.2f", lsupres);
}
else
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");/*ACTIVE*/
break;
case 5:
printf(" <20><><EFBFBD><EFBFBD>-䠪<><E4A0AA><EFBFBD> %.1f", warpfac);/*Warp Factor*/
break;
case 6:
printf(" <20><><EFBFBD><EFBFBD> %.2f", energy);/*Energy */
break;
case 7:
printf(" <20><><EFBFBD> %d", torps);/*Torpedoes*/
break;
case 8:
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ");/*Shields*/
if (damage[DSHIELD] != 0)
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,");/*DAMAGED*/
else if (shldup)
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,");/*UP*/
else
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,");/*DOWN*/
printf(" %d%% %.1f <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",/*units*/
(int)((100.0*shield)/inshld + 0.5), shield);
break;
case 9:
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E2A0AB><EFBFBD> %d", d.remkl);/*Klingons Left*/
break;
case 10:
printf(" <20><EFBFBD><E0A5AC><EFBFBD> <20><><EFBFBD><E2A0AB><EFBFBD> %.2f", d.remtime);/*Time Left*/
break;
}
}
skip(1);
if (k!=0) return;
}
if (nn) chart(1);
}
void eta(void) {
int key, ix1, ix2, iy1, iy2, prompt=FALSE;
int wfl;
double ttime, twarp, tpower;
if (damage[DCOMPTR] != 0.0) {
/* prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR."); */
prout("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
skip(1);
return;
}
if (scan() != IHREAL) {
prompt = TRUE;
chew();
/* proutn("Destination quadrant and/or sector? "); */
proutn("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7A5AD> <20>/<2F><><EFBFBD><><E1A5AA><EFBFBD>? ");
if (scan()!=IHREAL) {
huh();
return;
}
}
iy1 = aaitem +0.5;
if (scan() != IHREAL) {
huh();
return;
}
ix1 = aaitem + 0.5;
if (scan() == IHREAL) {
iy2 = aaitem + 0.5;
if (scan() != IHREAL) {
huh();
return;
}
ix2 = aaitem + 0.5;
}
else { // same quadrant
ix2 = ix1;
iy2 = iy1;
ix1 = quady; // ya got me why x and y are reversed!
iy1 = quadx;
}
if (ix1 > 8 || ix1 < 1 || iy1 > 8 || iy1 < 1 ||
ix2 > 10 || ix2 < 1 || iy2 > 10 || iy2 < 1) {
huh();
return;
}
dist = sqrt(square(iy1-quadx+0.1*(iy2-sectx))+
square(ix1-quady+0.1*(ix2-secty)));
wfl = FALSE;
/* if (prompt) prout("Answer \"no\" if you don't know the value:"); */
if (prompt) prout("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \"no\" <20><20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E7A5AD>:");
while (TRUE) {
chew();
/* proutn("Time or arrival date? "); */
proutn("<EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><EFBFBD><E0A8A1><EFBFBD><EFBFBD>? ");
if (scan()==IHREAL) {
ttime = aaitem;
if (ttime > d.date) ttime -= d.date; // Actually a star date
if (ttime <= 1e-10 ||
(twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) {
/* prout("We'll never make it, sir."); */
prout("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><><E1A4A5><EFBFBD><EFBFBD> <20><><EFBFBD>, <20><><EFBFBD>.");
chew();
return;
}
if (twarp < 1.0) twarp = 1.0;
break;
}
chew();
proutn("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>-䠪<><E4A0AA><EFBFBD>? ");/*Warp factor*/
if (scan()== IHREAL) {
wfl = TRUE;
twarp = aaitem;
if (twarp<1.0 || twarp > 10.0) {
huh();
return;
}
break;
}
/* prout("Captain, certainly you can give me one of these."); */
prout("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>⠭, <20><><EFBFBD> <20><><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD>⮢.");
}
while (TRUE) {
chew();
ttime = (10.0*dist)/square(twarp);
tpower = dist*twarp*twarp*twarp*(shldup+1);
if (tpower >= energy) { // Suggestion from Ethan Staffin -- give amount needed
/* prout("Insufficient energy, sir: we would need "); */
prout("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD>, <20><><EFBFBD>: <20><><EFBFBD> <20><EFBFBD> ");
cramf(tpower, 1, 1);
proutn (" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");/*units*/
if (shldup==0 || tpower > energy*2.0) {
if (!wfl) return;
/* proutn("New warp factor to try? "); */
proutn("<EFBFBD>஡㥬 <20><><EFBFBD> <20><><EFBFBD><EFBFBD>-䠪<><E4A0AA><EFBFBD>? ");
if (scan() == IHREAL) {
wfl = TRUE;
twarp = aaitem;
if (twarp<1.0 || twarp > 10.0) {
huh();
return;
}
continue;
}
else {
chew();
skip(1);
return;
}
}
/* prout("But if you lower your shields,");
proutn("remaining");
*/ prout("<EFBFBD><EFBFBD> <20><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1A8AB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>,");
proutn("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
tpower /= 2;
}
else
proutn("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); /*Remaining*/
proutn(" <20><><EFBFBD><EFBFBD> ");/*energy will be*/
cramf(energy-tpower, 1, 1);
prout(".");
if (wfl) {
/* proutn("And we will arrive at stardate "); */
proutn("<EFBFBD> <20><> <20><EFBFBD><20> <20><EFBFBD><E3A6AD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> ");
cramf(d.date+ttime, 1, 1);
prout(".");
}
else if (twarp==1.0)
/* prout("Any warp speed is adequate."); */
prout("<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><EFBFBD><><E1AAAE><EFBFBD><EFBFBD><EFBFBD> <20><>௠.");
else {
/* proutn("Minimum warp needed is "); */
proutn("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20>ॡ㥬<E0A5A1><E3A5AC> <20><><EFBFBD><EFBFBD>-᪮<><E1AAAE><EFBFBD><EFBFBD><EFBFBD> ");
cramf(twarp, 1, 2);
skip(1);
/* proutn("and we will arrive at stardate "); */
proutn("<EFBFBD> <20><> <20><EFBFBD><20> <20><EFBFBD><E3A6AD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> ");
cramf(d.date+ttime, 1, 2);
prout(".");
}
if (d.remtime < ttime)
/* prout("Unfortunately, the Federation will be destroyed by then."); */
prout("<EFBFBD><EFBFBD>砫쭮, <20><> <20><> <20><EFBFBD><E0A5AC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><><EFBFBD><E2AEA6><EFBFBD>.");
if (twarp > 6.0)
/* prout("You'll be taking risks at that speed, Captain"); */
prout("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>᪨ ⠪<><E2A0AA><><E1AAAE><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD>");
if ((isatb==1 && d.isy == ix1 && d.isx == iy1 &&
future[FSCDBAS]< ttime+d.date)||
(future[FCDBAS]<ttime+d.date && baty==ix1 && batx == iy1))
/* prout("The starbase there will be destroyed by then."); */
prout("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD> 㦥 㭨<><EFBFBD><E2AEA6><EFBFBD> <20> <20><EFBFBD> <20><EFBFBD><E0A5AC><EFBFBD>.");
/* proutn("New warp factor to try? "); */
proutn("<EFBFBD>஡㥬 <20><><EFBFBD> <20><><EFBFBD><EFBFBD>-䠪<><E4A0AA><EFBFBD>? ");
if (scan() == IHREAL) {
wfl = TRUE;
twarp = aaitem;
if (twarp<1.0 || twarp > 10.0) {
huh();
return;
}
}
else {
chew();
skip(1);
return;
}
}
}