Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #include "sst.h"
  2. #include <math.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5.  
  6. void attakreport(void) {
  7.         if (future[FCDBAS] < 1e30) {
  8.                 proutn("‘â ­æ¨ï ¢");/*Starbase in*/
  9.                 cramlc(1, batx, baty);
  10. /*              prout(" is currently under attack.");
  11.                 proutn("It can hold out until Stardate ");
  12.  */             prout(" ­ å®¤¨âáï ¯®¤  â ª®©.");
  13.                 proutn("Ž­  ¯à®¤¥à¦¨âáï ¬ ªá¨¬ã¬ ¤® ");
  14.                 cramf(future[FCDBAS], 0,1);
  15.                 prout(".");
  16.         }
  17.         if (isatb == 1) {
  18.                 proutn("‘â ­æ¨ï ¢");/*Starbase in*/
  19.                 cramlc(1, d.isx, d.isy);
  20. /*              prout(" is under Super-commander attack.");
  21.                 proutn("It can hold out until Stardate ");
  22.  */             prout(" ­ å®¤¨âáï ¯®¤  â ª®© ‘ã¯¥àŠ®¬¬ ­¤¥à .");
  23.                 proutn("Ž­  ¯à®¤¥à¦¨âáï ¬ ªá¨¬ã¬ ¤® ");
  24.                 cramf(future[FSCDBAS], 0, 1);
  25.                 prout(".");
  26.         }
  27. }
  28.        
  29.  
  30. void report(int f) {
  31.         char *s1,*s2,*s3;
  32.  
  33.         chew();
  34.         s1 = (thawed?"á®åà ­¥­­ãî ":"");/*thawed*/
  35.         switch (length) {
  36.                 case 1: s2="¡ëáâàãî/short"; break;
  37.                 case 2: s2="á।­îî/medium"; break;
  38.                 case 4: s2="¤«¨­­ãî/long"; break;
  39.                 default: s2="­¥¨§¢¥áâ­®© ¤«¨â¥«ì­®áâ¨/unknown length"; break;
  40.         }
  41.         switch (skill) {
  42.                 case SNOVICE: s3="­®¢¨ç®ª"; break;/*novice*/
  43.                 case SFAIR: s3="á « £ "; break;/*fair*/
  44.                 case SGOOD: s3="®â«¨ç­¨ª"; break;/*good*/
  45.                 case SEXPERT: s3="íªá¯¥àâ"; break;/*expert*/
  46.                 case SEMERITUS: s3="í¬¥à¨âãá"; break;/*emeritus*/
  47.                 default: s3="®¯ëâ­ë©"; break;/*skilled*/
  48.         }
  49. /*      printf("\nYou %s playing a %s%s %s game.\n",
  50.                    alldone? "were": "are now", s1, s2, s3);
  51.  */     printf("\n‚ë %s a %s%s ¨£àã ­  á«®¦­®á⨠%s.\n",
  52.                    alldone? "áë£à «¨": "ᥩç á ¨£à ¥â¥", s1, s2, s3);
  53.         if (skill>SGOOD && thawed && !alldone) prout("‡­ ª ®â«¨ç¨ï ­¥ ¢ë¤ ¥âáï.");/*No plaque is allowed*/
  54.         /* if (tourn) printf("This is tournament game %d.\n", tourn); */
  55.         if (tourn) printf("â® âãà­¨à­ ï ¨£à  %d.\n", tourn);
  56.         /* if (f) printf("Your secret password is \"%s\"\n",passwd); */
  57.         if (f) printf("‚ è ᥪà¥â­ë© ¯ à®«ì \"%s\"\n",passwd);
  58.         /* printf("%d of %d Klingon ships have been destroyed", */
  59.         printf("%d ¨§ %d ª«¨­£®­áª¨å ª®à ¡«¥© ã­¨ç⮦¥­®",
  60.                    d.killk+d.killc+d.nsckill, inkling);
  61.         /* if (d.killc) printf(", including %d Commander%s.\n", d.killc, d.killc==1?"":"s"); */
  62.         if (d.killc) printf(", ¢ª«îç ï %d Š®¬¬ ­¤¥à%s.\n", d.killc, d.killc==1?" ":"®¢");
  63.         else if (d.killk+d.nsckill > 0) prout(", ­® ­¨ ®¤­®£® Š®¬¬ ­¤¥à .");/*but no Commanders*/
  64.         else prout(".");
  65. /*      if (skill > SFAIR) printf("The Super Commander has %sbeen destroyed.\n",
  66.                                                   d.nscrem?"not ":"");
  67.  */     if (skill > SFAIR) printf("‘ã¯¥àŠ®¬¬ ­¤¥à %s¡ë« ã­¨ç⮦¥­.\n",
  68.                                                   d.nscrem?"­¥ ":"");
  69.         if (d.rembase != inbase) {
  70. /*              proutn("There ");
  71.                 if (inbase-d.rembase==1) proutn("has been 1 base");
  72.                 else {
  73.                         proutn("have been ");
  74.                         crami(inbase-d.rembase, 1);
  75.                         proutn(" bases");
  76.                 }
  77.                 proutn(" destroyed, ");
  78.                 crami(d.rembase, 1);
  79.                 prout(" remaining.");
  80.  */            
  81.                 if (inbase-d.rembase==1) proutn("…¤¨­á⢥­­ ï áâ ­æ¨ï ¡ë«  ã­¨ç⮦¥­ ,");
  82.                 else {
  83.                         proutn("ë«® ");
  84.                         crami(inbase-d.rembase, 1);
  85.                         proutn(" á⠭権 ã­¨ç⮦¥­®, ");
  86.                 }
  87.                 crami(d.rembase, 1);
  88.                 prout(" ®áâ «®áì.");
  89.         }
  90.         else printf("‚ᥣ® %d á⠭権.\n", inbase);/*There are %d bases*/
  91.         if (REPORTS || iseenit) {
  92.                 /* Don't report this if not seen and
  93.                         either the radio is dead or not at base! */
  94.                 attakreport();
  95.                 iseenit = 1;
  96.         }
  97. /*      if (casual) printf("%d casualt%s suffered so far.\n",
  98.                                            casual, casual==1? "y" : "ies");
  99.  */     if (casual) printf("%d ᬥàâ%s á।¨ íª¨¯ ¦ .\n",
  100.                                            casual, casual==1? "ì" : "¥©");
  101. #ifdef CAPTURE
  102. /*     if (brigcapacity != brigfree) printf("%d Klingon%s in brig.\n",
  103.                                                         brigcapacity-brigfree, brigcapacity-brigfree>1 ? "s" : "");
  104.  */    if (brigcapacity != brigfree) printf("%d ª«¨­£®­%s ­  ¡à¨£¥.\n",
  105.                                                         brigcapacity-brigfree, brigcapacity-brigfree>1 ? "®¢" : "");
  106. /*     if (kcaptured > 0) printf("%d captured Klingon%s turned in to Star Fleet.\n",
  107.                                kcaptured, kcaptured>1 ? "s" : "");
  108.  */    if (kcaptured > 0) printf("%d ¯«¥­­ëå ª«¨­£®­%s ¯à¨á®¥¤¨­¨«¨áì ª ‡¢¥§¤­®¬ã ”«®âã.\n",
  109.                                kcaptured, kcaptured>1 ? "®¢" : "");
  110. #endif
  111. /*      if (nhelp) printf("There were %d call%s for help.\n",
  112.                                           nhelp, nhelp==1 ? "" : "s");
  113.  */     if (nhelp) printf("‡ ä¨ªá¨à®¢ ­® %d ¢ë§®¢%s ® ¯®¬®é¨.\n",
  114.                                           nhelp, nhelp==1 ? "" : "®¢");
  115.         if (ship == IHE) {
  116.                 proutn("“ ¢ á ®áâ «®áì ");/**/
  117.                 if (nprobes) crami(nprobes,1);
  118.                 else proutn("0");/*no*/
  119.                 proutn(" à §¢¥¤§®­¤");/*deep space probe*/
  120.                 if (nprobes!=1) proutn("®¢");/*s*/
  121.                 prout(".");
  122.         }
  123.         if (REPORTS && future[FDSPROB] != 1e30) {
  124.                 if (isarmed)
  125.                         /* proutn("An armed deep space probe is in"); */
  126.                         proutn(" §¢¥¤ë¢ â¥«ì­ë© §®­¤ á ¡®¥£®«®¢ª®© ¢ â®çª¥");
  127.                 else
  128.                         proutn(" §¢¥¤ë¢ â¥«ì­ë© §®­¤ ¢ â®çª¥");/*A deep space probe is in*/
  129.                 cramlc(1, probecx, probecy);
  130.                 prout(".");
  131.         }
  132.         if (icrystl) {
  133.                 if (cryprob <= .05)
  134.                         /* prout("Dilithium crystals aboard ship...not yet used."); */
  135.                         prout("„¨«¨â¨¥¢ë¥ ªà¨áâ ««ë ­  ¡®àâã...­¥ ¡ë«¨ ¨á¯®«ì§®¢ ­ë.");
  136.                 else {
  137.                         int i=0;
  138.                         double ai = 0.05;
  139.                         while (cryprob > ai) {
  140.                                 ai *= 2.0;
  141.                                 i++;
  142.                         }
  143. /*                      printf("Dilithium crystals have been used %d time%s.\n",
  144.                                    i, i==1? "" : "s");
  145.  */                     printf("„¨«¨â¨¥¢ë¥ ªà¨áâ «« ¨á¯®«ì§®¢ «¨áì %d à §%s.\n",
  146.                                    i, (i>1 && i<5)? " " : "");
  147.                 }
  148.         }
  149.         skip(1);
  150. }
  151.        
  152. void lrscan(void) {
  153.         int x, y;
  154.         chew();
  155.         if (damage[DLRSENS] != 0.0) {
  156.                 /* Now allow base's sensors if docked */
  157.                 if (condit != IHDOCKED) {
  158.                         /* prout("LONG-RANGE SENSORS DAMAGED."); */
  159.                         prout("‘…‘Ž› „€‹œ…ƒŽ Ž‡Ž€ Ž‚…†„…›.");
  160.                         return;
  161.                 }
  162.                 skip(1);
  163.                 /* proutn("Starbase's long-range scan for"); */
  164.                 proutn("ˆá¯®«ì§ã¥¬ ᥭá®àë á⠭樨 ¤«ï");
  165.         }
  166.         else {
  167.                 skip(1);
  168.                 /* proutn("Long-range scan for"); */
  169.                 proutn("à®¨§¢®¤¨¬ ¤ «ì­¥¥ ᪠­¨à®¢ ­¨¥ ¤«ï");
  170.         }
  171.         cramlc(1, quadx, quady);
  172.         skip(1);
  173.         if (coordfixed)
  174.         for (y = quady+1; y >= quady-1; y--) {
  175.                 for (x = quadx-1; x <= quadx+1; x++) {
  176.                         if (x == 0 || x > 8 || y == 0 || y > 8)
  177.                                 printf("   -1");
  178.                         else {
  179.                                 printf("%5d", d.galaxy[x][y]);
  180.                                 // If radio works, mark star chart so
  181.                                 // it will show current information.
  182.                                 // Otherwise mark with current
  183.                                 // value which is fixed.
  184.                                 starch[x][y] = damage[DRADIO] > 0 ? d.galaxy[x][y]+1000 :1;
  185.                         }
  186.                 }
  187.                 putchar('\n');
  188.         }
  189.         else
  190.         for (x = quadx-1; x <= quadx+1; x++) {
  191.                 for (y = quady-1; y <= quady+1; y++) {
  192.                         if (x == 0 || x > 8 || y == 0 || y > 8)
  193.                                 printf("   -1");
  194.                         else {
  195.                                 printf("%5d", d.galaxy[x][y]);
  196.                                 // If radio works, mark star chart so
  197.                                 // it will show current information.
  198.                                 // Otherwise mark with current
  199.                                 // value which is fixed.
  200.                                 starch[x][y] = damage[DRADIO] > 0 ? d.galaxy[x][y]+1000 :1;
  201.                         }
  202.                 }
  203.                 putchar('\n');
  204.         }
  205.  
  206. }
  207.  
  208. void dreprt(void) {
  209.         int jdam = FALSE, i;
  210.         chew();
  211.  
  212.         for (i = 1; i <= ndevice; i++) {
  213.                 if (damage[i] > 0.0) {
  214.                         if (!jdam) {
  215.                                 skip(1);
  216. /*                              prout("DEVICE            -REPAIR TIMES-");
  217.                                 prout("                IN FLIGHT   DOCKED");
  218.  */                             prout("Ž„‘ˆ‘’…Œ€        -‚…ŒŸ € …ŒŽ’-");
  219.                                 prout("                ‚ ŠŽ‘ŒŽ‘…   € ‘’€–ˆˆ");
  220.                                 jdam = TRUE;
  221.                         }
  222.                         printf("  %16s ", device[i]);
  223.                         cramf(damage[i]+0.05, 8, 2);
  224.                         proutn("  ");
  225.                         cramf(docfac*damage[i]+0.005, 8, 2);
  226.                         skip(1);
  227.                 }
  228.         }
  229.         /* if (!jdam) prout("All devices functional."); */
  230.         if (!jdam) prout("‚ᥠ¯®¤á¨áâ¥¬ë ¨á¯à ¢­ë.");
  231. }
  232.  
  233. void chart(int nn) {
  234.         int i,j;
  235.  
  236.         chew();
  237.         skip(1);
  238.         if (stdamtim != 1e30 && stdamtim != d.date && condit == IHDOCKED) {
  239. /*              prout("Spock-  \"I revised the Star Chart from the");
  240.                 prout("  starbase's records.\"");
  241.  */             prout("‘¯®ª-  \"Ÿ ®¡­®¢¨« §¢¥§¤­ãî ª àâã");
  242.                 prout("  ¯® ¤ ­­ë¬ á⠭樨.\"");
  243.                 skip(1);
  244.         }
  245.         /* if (nn == 0) prout("STAR CHART FOR THE KNOWN GALAXY"); */
  246.         if (nn == 0) prout("‡‚…‡„€Ÿ Š€’€ ˆ‡‚…‘’Ž‰ —€‘’ˆ ƒ€‹€Š’ˆŠˆ");
  247.         if (stdamtim != 1e30) {
  248.                 if (condit == IHDOCKED) {
  249.                         /* We are docked, so restore chart from base information -- these values won't update! */
  250.                         stdamtim = d.date;
  251.                         for (i=1; i <= 8 ; i++)
  252.                                 for (j=1; j <= 8; j++)
  253.                                         if (starch[i][j] == 1) starch[i][j] = d.galaxy[i][j]+1000;
  254.                 }
  255.                 else {
  256.                         proutn("(®á«¥¤­¥¥ ®¡­®¢«¥­¨¥ ¤ ­­ëå ");/*Last surveillance update*/
  257.                         cramf(d.date-stdamtim, 0, 1);
  258.                         prout(" §¢¥§¤­ëå «¥â ­ § ¤.)");/*stardates ago*/
  259.                 }
  260.         }
  261.         if (nn ==0) skip(1);
  262.  
  263.         prout("      1    2    3    4    5    6    7    8");
  264.         prout("    ----------------------------------------");
  265.         if (nn==0) prout("  -");
  266.         if (coordfixed)
  267.         for (j = 8; j >= 1; j--) {
  268.                 printf("%d -", j);
  269.                 for (i = 1; i <= 8; i++) {
  270.                         if (starch[i][j] < 0) // We know only about the bases
  271.                                 printf("  .1.");
  272.                         else if (starch[i][j] == 0) // Unknown
  273.                                 printf("  ...");
  274.                         else if (starch[i][j] > 999) // Memorized value
  275.                                 printf("%5d", starch[i][j]-1000);
  276.                         else
  277.                                 printf("%5d", d.galaxy[i][j]); // What is actually there (happens when value is 1)
  278.                 }
  279.                 prout("  -");
  280.         }
  281.         else
  282.         for (i = 1; i <= 8; i++) {
  283.                 printf("%d -", i);
  284.                 for (j = 1; j <= 8; j++) {
  285.                         if (starch[i][j] < 0) // We know only about the bases
  286.                                 printf("  .1.");
  287.                         else if (starch[i][j] == 0) // Unknown
  288.                                 printf("  ...");
  289.                         else if (starch[i][j] > 999) // Memorized value
  290.                                 printf("%5d", starch[i][j]-1000);
  291.                         else
  292.                                 printf("%5d", d.galaxy[i][j]); // What is actually there (happens when value is 1)
  293.                 }
  294.                 prout("  -");
  295.         }
  296.         if (nn == 0) {
  297.                 skip(1);
  298.                 crmshp();
  299.                 proutn(" ­ å®¤¨âáï ¢ â®çª¥");/*is currently in*/
  300.                 cramlc(1, quadx, quady);
  301.                 skip(1);
  302.         }
  303. }
  304.                
  305.                
  306. void srscan(int l) {
  307.         static char requests[][3] =
  308.                 {"","da","co","po","ls","wa","en","to","sh","kl","ti"};
  309.         char *cp;
  310.         int leftside=TRUE, rightside=TRUE, i, j, jj, k=0, nn=FALSE;
  311.         int goodScan=TRUE;
  312.         switch (l) {
  313.                 case 1: // SRSCAN
  314.                         if (damage[DSRSENS] != 0) {
  315.                                 /* Allow base's sensors if docked */
  316.                                 if (condit != IHDOCKED) {
  317.                                         /* prout("SHORT-RANGE SENSORS DAMAGED"); */
  318.                                         prout("‹ˆ†ˆ… ‘…‘Ž› Ž‚…†„…›");
  319.                                         goodScan=FALSE;
  320.                                 }
  321.                                 else
  322.                                         /* prout("[Using starbase's sensors]"); */
  323.                                         prout("[ˆá¯®«ì§ã¥¬ ᥭá®àë á⠭樨]");
  324.                         }
  325.                         if (goodScan)
  326.                                 starch[quadx][quady] = damage[DRADIO]>0.0 ?
  327.                                                                            d.galaxy[quadx][quady]+1000:1;
  328.                         scan();
  329.                         if (isit("chart")) nn = TRUE;
  330.                         if (isit("no")) rightside = FALSE;
  331.                         chew();
  332.                         prout("\n    1 2 3 4 5 6 7 8 9 10");
  333.                         break;
  334.                 case 2: // REQUEST
  335.                         while (scan() == IHEOL)
  336.                                 /* printf("Information desired? "); */
  337.                                 printf("†¥« ¥¬ ï ¨­ä®à¬ æ¨ï? ");
  338.                         chew();
  339.                         for (k = 1; k <= 10; k++)
  340.                                 if (strncmp(citem,requests[k],min(2,strlen(citem)))==0)
  341.                                         break;
  342.                         if (k > 10) {
  343. /*                              prout("UNRECOGNIZED REQUEST. Legal requests are:\n"
  344.                                          "  date, condition, position, lsupport, warpfactor,\n"
  345.                                          "  energy, torpedoes, shields, klingons, time.");
  346.  */                             prout("‡€Ž‘ …€‘Ž‡€. Š®à४â­ë¥ § ¯à®áë (¤¢¥ ¡ãª¢ë):\n"
  347.                                          "  date(¤ â ), condition(á®áâ®ï­¨¥), position(¯®«®¦¥­¨¥),\n"
  348.                                          "  lsupport (¦¨§­¥®¡¥á¯¥ç¥­¨¥), warpfactor (¢ à¯-ä ªâ®à),\n"
  349.                                          "  energy(í­¥à£¨ï), torpedoes(â®à¯¥¤ë), shields (ᨫ®¢ë¥ é¨âë),\n"
  350.                                          "  klingons(ª«¨­£®­ë), time(¢à¥¬ï).");
  351.                                 return;
  352.                         }
  353.                         // no "break"
  354.                 case 3: // STATUS
  355.                         chew();
  356.                         leftside = FALSE;
  357.                         skip(1);
  358.         }
  359.         for (i = 1; i <= 10; i++) {
  360.                 int jj = (k!=0 ? k : i);
  361.                 if (leftside) {
  362.                         if (coordfixed) {
  363.                                 printf("%2d  ", 11-i);
  364.                                 for (j = 1; j <= 10; j++) {
  365.                                         if (goodScan || (abs((11-i)-secty)<= 1 && abs(j-sectx) <= 1))
  366.                                                 printf("%c ",quad[j][11-i]);
  367.                                         else
  368.                                                 printf("- ");
  369.                                 }
  370.                         } else {
  371.                                 printf("%2d  ", i);
  372.                                 for (j = 1; j <= 10; j++) {
  373.                                         if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1))
  374.                                                 printf("%c ",quad[i][j]);
  375.                                         else
  376.                                                 printf("- ");
  377.                                 }
  378.                         }
  379.                 }
  380.                 if (rightside) {
  381.                         switch (jj) {
  382.                                 case 1:
  383.                                         printf(" ‡¢¥§¤­ ï ¤ â       %.1f", d.date);/*Stardate*/
  384.                                         break;
  385.                                 case 2:
  386.                                         if (condit != IHDOCKED) newcnd();
  387.                                         switch (condit) {
  388.                                                 case IHRED: cp = "Š€‘›‰"; break;/*RED*/
  389.                                                 case IHGREEN: cp = "‡…‹…›‰"; break;/*GREEN*/
  390.                                                 case IHYELLOW: cp = "†…‹’›‰"; break;/*YELLOW*/
  391.                                                 case IHDOCKED: cp = "ˆ‘’›ŠŽ‚€"; break;/*DOCKED*/
  392.                                         }
  393.                                         /* printf(" Condition     %s", cp); */
  394.                                         printf(" ‘®áâ®ï­¨¥/‘â âãá %s", cp);
  395. #ifdef CLOAKING
  396.                                     if (iscloaked) printf(", Œ€ŠˆŽ‚€");/*CLOAKED*/
  397. #endif
  398.                                         break;
  399.                                 case 3:
  400.                                         printf(" ®«®¦¥­¨¥     ");/*Position*/
  401.                                         cramlc(0, quadx, quady);
  402.                                         putchar(',');
  403.                                         cramlc(0, sectx, secty);
  404.                                         break;
  405.                                 case 4:
  406.                                         printf(" †¨§­¥®¡¥á¯¥ç¥­¨¥  ");/*Life Support*/
  407.                                         if (damage[DLIFSUP] != 0.0) {
  408.                                                 if (condit == IHDOCKED)
  409. /*                                                      printf("DAMAGED, supported by starbase");
  410.                                                 else
  411.                                                         printf("DAMAGED, reserves=%4.2f", lsupres);
  412.  */                                                     printf("Ž‚…†„…Ž, ¯¨â ¥¬áï ®â á⠭樨");
  413.                                                 else
  414.                                                         printf("Ž‚…†„…Ž, १¥à¢=%4.2f", lsupres);
  415.                                         }
  416.                                         else
  417.                                                 printf("€Š’ˆ‚Ž");/*ACTIVE*/
  418.                                         break;
  419.                                 case 5:
  420.                                         printf(" ‚ à¯-ä ªâ®à   %.1f", warpfac);/*Warp Factor*/
  421.                                         break;
  422.                                 case 6:
  423.                                         printf(" ­¥à£¨ï       %.2f", energy);/*Energy */
  424.                                         break;
  425.                                 case 7:
  426.                                         printf(" ’®à¯¥¤        %d", torps);/*Torpedoes*/
  427.                                         break;
  428.                                 case 8:
  429.                                         printf(" ‘¨«®¢ë¥ é¨âë       ");/*Shields*/
  430.                                         if (damage[DSHIELD] != 0)
  431.                                                 printf("Ž‚…†„…›,");/*DAMAGED*/
  432.                                         else if (shldup)
  433.                                                 printf("€Š’ˆ‚›,");/*UP*/
  434.                                         else
  435.                                                 printf("Ž’Š‹ž—…›,");/*DOWN*/
  436.                                         printf(" %d%% %.1f ¥¤¨­¨æ",/*units*/
  437.                                                    (int)((100.0*shield)/inshld + 0.5), shield);
  438.                                         break;
  439.                                 case 9:
  440.                                         printf(" Š«¨­£®­®¢ ®áâ «®áì %d", d.remkl);/*Klingons Left*/
  441.                                         break;
  442.                                 case 10:
  443.                                         printf(" ‚६¥­¨ ®áâ «®áì     %.2f", d.remtime);/*Time Left*/
  444.                                         break;
  445.                         }
  446.                                        
  447.                 }
  448.                 skip(1);
  449.                 if (k!=0) return;
  450.         }
  451.         if (nn) chart(1);
  452. }
  453.                        
  454.                        
  455. void eta(void) {
  456.         int key, ix1, ix2, iy1, iy2, prompt=FALSE;
  457.         int wfl;
  458.         double ttime, twarp, tpower;
  459.         if (damage[DCOMPTR] != 0.0) {
  460.                 /* prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR."); */
  461.                 prout("ŠŽŒœž’… Ž‚…†„…, ˆ‘Ž‹œ‡“ž €‘’Ž‹œ›‰ Š€‹œŠ“‹Ÿ’Ž.");
  462.                 skip(1);
  463.                 return;
  464.         }
  465.         if (scan() != IHREAL) {
  466.                 prompt = TRUE;
  467.                 chew();
  468.                 /* proutn("Destination quadrant and/or sector? "); */
  469.                 proutn("Š¢ ¤à ­â ­ §­ ç¥­¨ï ¨/¨«¨ ᥪâ®à? ");
  470.                 if (scan()!=IHREAL) {
  471.                         huh();
  472.                         return;
  473.                 }
  474.         }
  475.         iy1 = aaitem +0.5;
  476.         if (scan() != IHREAL) {
  477.                 huh();
  478.                 return;
  479.         }
  480.         ix1 = aaitem + 0.5;
  481.         if (scan() == IHREAL) {
  482.                 iy2 = aaitem + 0.5;
  483.                 if (scan() != IHREAL) {
  484.                         huh();
  485.                         return;
  486.                 }
  487.                 ix2 = aaitem + 0.5;
  488.         }
  489.         else {  // same quadrant
  490.                 ix2 = ix1;
  491.                 iy2 = iy1;
  492.                 ix1 = quady;    // ya got me why x and y are reversed!
  493.                 iy1 = quadx;
  494.         }
  495.  
  496.         if (ix1 > 8 || ix1 < 1 || iy1 > 8 || iy1 < 1 ||
  497.                 ix2 > 10 || ix2 < 1 || iy2 > 10 || iy2 < 1) {
  498.                 huh();
  499.                 return;
  500.         }
  501.         dist = sqrt(square(iy1-quadx+0.1*(iy2-sectx))+
  502.                                 square(ix1-quady+0.1*(ix2-secty)));
  503.         wfl = FALSE;
  504.  
  505.         /* if (prompt) prout("Answer \"no\" if you don't know the value:"); */
  506.         if (prompt) prout("Žâ¢¥âì⥠\"no\" ¥á«¨ ¢ë ­¥ §­ ¥â¥ §­ ç¥­¨¥:");
  507.         while (TRUE) {
  508.                 chew();
  509.                 /* proutn("Time or arrival date? "); */
  510.                 proutn("‚à¥¬ï ¨«¨ ¤ â  ¯à¨¡ëâ¨ï? ");
  511.                 if (scan()==IHREAL) {
  512.                         ttime = aaitem;
  513.                         if (ttime > d.date) ttime -= d.date; // Actually a star date
  514.                         if (ttime <= 1e-10 ||
  515.                                 (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) {
  516.                                 /* prout("We'll never make it, sir."); */
  517.                                 prout("Œë ­¨ª®£¤  ­¥ ᤥ« ¥¬ íâ®, ‘íà.");
  518.                                 chew();
  519.                                 return;
  520.                         }
  521.                         if (twarp < 1.0) twarp = 1.0;
  522.                         break;
  523.                 }
  524.                 chew();
  525.                 proutn("‚ à¯-ä ªâ®à? ");/*Warp factor*/
  526.                 if (scan()== IHREAL) {
  527.                         wfl = TRUE;
  528.                         twarp = aaitem;
  529.                         if (twarp<1.0 || twarp > 10.0) {
  530.                                 huh();
  531.                                 return;
  532.                         }
  533.                         break;
  534.                 }
  535.                 /* prout("Captain, certainly you can give me one of these."); */
  536.                 prout("Š ¯¨â ­, ¬­¥ ®¯à¥¤¥«¥­­® ­ã¦­® §­ âì ®¤¨­ ¨§ ¢ à¨ ­â®¢.");
  537.         }
  538.         while (TRUE) {
  539.                 chew();
  540.                 ttime = (10.0*dist)/square(twarp);
  541.                 tpower = dist*twarp*twarp*twarp*(shldup+1);
  542.                 if (tpower >= energy) { // Suggestion from Ethan Staffin -- give amount needed
  543.                         /* prout("Insufficient energy, sir: we would need "); */
  544.                         prout("¥¤®áâ â®ç­® í­¥à£¨¨, ‘íà: ­ ¬ ­ã¦­® ");
  545.                         cramf(tpower, 1, 1);
  546.                         proutn (" ¥¤¨­¨æ.");/*units*/
  547.                         if (shldup==0 || tpower > energy*2.0) {
  548.                                 if (!wfl) return;
  549.                                 /* proutn("New warp factor to try? "); */
  550.                                 proutn("à®¡ã¥¬ ¤à㣮© ¢ à¯-ä ªâ®à? ");
  551.                                 if (scan() == IHREAL) {
  552.                                         wfl = TRUE;
  553.                                         twarp = aaitem;
  554.                                         if (twarp<1.0 || twarp > 10.0) {
  555.                                                 huh();
  556.                                                 return;
  557.                                         }
  558.                                         continue;
  559.                                 }
  560.                                 else {
  561.                                         chew();
  562.                                         skip(1);
  563.                                         return;
  564.                                 }
  565.                         }
  566. /*                      prout("But if you lower your shields,");
  567.                         proutn("remaining");
  568.  */                     prout("® ¥á«¨ ®¯ãáâ¨âì ᨫ®¢ë¥ é¨âë,");
  569.                         proutn("®áâ ­¥âáï");
  570.                         tpower /= 2;
  571.                 }
  572.                 else
  573.                         proutn("Žáâ ­¥âáï"); /*Remaining*/
  574.                 proutn(" í­¥à£¨¨ ");/*energy will be*/
  575.                 cramf(energy-tpower, 1, 1);
  576.                 prout(".");
  577.                 if (wfl) {
  578.                         /* proutn("And we will arrive at stardate "); */
  579.                         proutn("ˆ ¬ë ¯à¨«¥â¨¬ ¢ ­ã¦­ãî â®çªã ª ¤ â¥ ");
  580.                         cramf(d.date+ttime, 1, 1);
  581.                         prout(".");
  582.                 }
  583.                 else if (twarp==1.0)
  584.                         /* prout("Any warp speed is adequate."); */
  585.                         prout(" á ãáâந⠫ï ᪮à®áâì ¢ à¯ .");
  586.                 else {
  587.                         /* proutn("Minimum warp needed is "); */
  588.                         proutn("Œ¨­¨¬ «ì­® âॡ㥬 ï ¢ à¯-᪮à®áâì ");
  589.                         cramf(twarp, 1, 2);
  590.                         skip(1);
  591.                         /* proutn("and we will arrive at stardate "); */
  592.                         proutn("¨ ¬ë ¯à¨«¥â¨¬ ¢ ­ã¦­ãî â®çªã ª ¤ â¥ ");
  593.                         cramf(d.date+ttime, 1, 2);
  594.                         prout(".");
  595.                 }
  596.                 if (d.remtime < ttime)
  597.                         /* prout("Unfortunately, the Federation will be destroyed by then."); */
  598.                         prout("¥ç «ì­®, ­® ª ⮬㠢६¥­¨ ”¥¤¥à æ¨ï ¡ã¤¥â ã­¨ç⮦¥­ .");
  599.                 if (twarp > 6.0)
  600.                         /* prout("You'll be taking risks at that speed, Captain"); */
  601.                         prout("‚ë ¤®«¦­ë ¯®­¨¬ âì à¨áª¨ â ª®© ᪮à®áâ¨, Š ¯¨â ­");
  602.                 if ((isatb==1 && d.isy == ix1 && d.isx == iy1 &&
  603.                          future[FSCDBAS]< ttime+d.date)||
  604.                         (future[FCDBAS]<ttime+d.date && baty==ix1 && batx == iy1))
  605.                         /* prout("The starbase there will be destroyed by then."); */
  606.                         prout("‘â ­æ¨ï ¡ã¤¥â 㦥 ã­¨ç⮦¥­  ª í⮬㠢६¥­¨.");
  607.                 /* proutn("New warp factor to try? "); */
  608.                 proutn("à®¡ã¥¬ ¤à㣮© ¢ à¯-ä ªâ®à? ");
  609.                 if (scan() == IHREAL) {
  610.                         wfl = TRUE;
  611.                         twarp = aaitem;
  612.                         if (twarp<1.0 || twarp > 10.0) {
  613.                                 huh();
  614.                                 return;
  615.                         }
  616.                 }
  617.                 else {
  618.                         chew();
  619.                         skip(1);
  620.                         return;
  621.                 }
  622.         }
  623.                        
  624. }
  625.