5 static void getcd(bool, int);
7 void imove(bool novapush)
8 /* movement execution for warp, impulse, supernova, and tractor-beam events */
10 double angle, deltax, deltay, bigger, x, y,
11 finald, stopegy, probf;
12 int n, m, kink, kinks;
19 prout(_("Helmsman Sulu- \"Leaving standard orbit.\""));
23 angle = ((15.0 - game.direc) * 0.5235988);
26 if (fabs(deltax) > fabs(deltay))
27 bigger = fabs(deltax);
29 bigger = fabs(deltay);
34 /* If tractor beam is to occur, don't move full distance */
35 if (game.state.date+game.optime >= scheduled(FTBEAM)) {
38 game.dist = game.dist*(scheduled(FTBEAM)-game.state.date)/game.optime + 0.1;
39 game.optime = scheduled(FTBEAM) - game.state.date + 1e-5;
41 /* Move within the quadrant */
42 game.quad[game.sector.x][game.sector.y] = IHDOT;
45 n = 10.0*game.dist*bigger+0.5;
48 for (m = 1; m <= n; m++) {
49 w.x = (x += deltax) + 0.5;
50 w.y = (y += deltay) + 0.5;
51 if (!VALID_SECTOR(w.x, w.y)) {
52 /* Leaving quadrant -- allow final enemy attack */
53 /* Don't do it if being pushed by Nova */
54 if (game.nenhere != 0 && !novapush) {
56 for (m = 1; m <= game.nenhere; m++) {
57 finald = distance(w, game.ks[m]);
58 game.kavgd[m] = 0.5 * (finald + game.kdist[m]);
61 * Stas Sergeev added the condition
62 * that attacks only happen if Klingons
63 * are present and your skill is good.
65 if (game.skill > SKILL_GOOD && game.klhere > 0 && !game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova)
70 /* compute final position -- new quadrant and sector */
71 x = QUADSIZE*(game.quadrant.x-1)+game.sector.x;
72 y = QUADSIZE*(game.quadrant.y-1)+game.sector.y;
73 w.x = x+10.0*game.dist*bigger*deltax+0.5;
74 w.y = y+10.0*game.dist*bigger*deltay+0.5;
75 /* check for edge of galaxy */
87 if (w.x > GALSIZE*QUADSIZE) {
88 w.x = (GALSIZE*QUADSIZE*2)+1 - w.x;
91 if (w.y > GALSIZE*QUADSIZE) {
92 w.y = (GALSIZE*QUADSIZE*2)+1 - w.y;
101 if (game.nkinks == 3) {
102 /* Three strikes -- you're out! */
107 prout(_("YOU HAVE ATTEMPTED TO CROSS THE NEGATIVE ENERGY BARRIER"));
108 prout(_("AT THE EDGE OF THE GALAXY. THE THIRD TIME YOU TRY THIS,"));
109 prout(_("YOU WILL BE DESTROYED."));
111 /* Compute final position in new quadrant */
112 if (trbeam) /* Don't bother if we are to be beamed */
114 game.quadrant.x = (w.x+(QUADSIZE-1))/QUADSIZE;
115 game.quadrant.y = (w.y+(QUADSIZE-1))/QUADSIZE;
116 game.sector.x = w.x - QUADSIZE*(game.quadrant.x-1);
117 game.sector.y = w.y - QUADSIZE*(game.quadrant.y-1);
119 prout(_("Entering %s."), cramlc(quadrant, game.quadrant));
120 game.quad[game.sector.x][game.sector.y] = game.ship;
122 if (game.skill>SKILL_NOVICE)
126 iquad = game.quad[w.x][w.y];
127 if (iquad != IHDOT) {
128 /* object encountered in flight path */
129 stopegy = 50.0*game.dist/game.optime;
130 game.dist = distance(game.sector, w) / (QUADSIZE * 1.0);
132 case IHT: /* Ram a Tholian */
133 case IHK: /* Ram enemy ship */
139 ram(false, iquad, game.sector);
144 prouts(_("***RED ALERT! RED ALERT!"));
148 proutn(_(" pulled into black hole at "));
149 prout(cramlc(sector, w));
151 * Getting pulled into a black hole was certain
152 * death in Almy's original. Stas Sergeev added a
153 * possibility that you'll get timewarped instead.
156 for (m=0;m<NDEVICES;m++)
157 if (game.damage[m]>0)
159 probf=pow(1.4,(game.energy+game.shield)/5000.0-1.0)*pow(1.3,1.0/(n+1)-1.0);
160 if ((game.options & OPTION_BLKHOLE) && Rand()>probf)
170 proutn(_(" encounters Tholian web at "));
172 proutn(_(" blocked by object at "));
173 proutn(cramlc(sector, w));
175 proutn(_("Emergency stop required "));
176 prout(_("%2d units of energy."), (int)stopegy);
177 game.energy -= stopegy;
178 final.x = x-deltax+0.5;
179 final.y = y-deltay+0.5;
181 if (game.energy <= 0) {
187 goto no_quad_change; /* sorry! */
190 game.dist = distance(game.sector, w) / (QUADSIZE * 1.0);
195 /* No quadrant change -- compute new avg enemy distances */
196 game.quad[game.sector.x][game.sector.y] = game.ship;
198 for (m = 1; m <= game.nenhere; m++) {
199 finald = distance(w, game.ks[m]);
200 game.kavgd[m] = 0.5 * (finald+game.kdist[m]);
201 game.kdist[m] = finald;
204 if (!game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova)
206 for (m = 1; m <= game.nenhere; m++)
207 game.kavgd[m] = game.kdist[m];
211 setwnd(message_window);
215 void dock(bool verbose)
216 /* dock our ship at a starbase */
219 if (game.condition == docked && verbose) {
220 prout(_("Already docked."));
224 prout(_("You must first leave standard orbit."));
227 if (!is_valid(game.base) || abs(game.sector.x-game.base.x) > 1 || abs(game.sector.y-game.base.y) > 1) {
229 prout(_(" not adjacent to base."));
232 game.condition = docked;
236 if (game.energy < game.inenrg)
237 game.energy = game.inenrg;
238 game.shield = game.inshld;
239 game.torps = game.intorps;
240 game.lsupres = game.inlsr;
241 game.state.crew = FULLCREW;
242 if (!damaged(DRADIO) &&
243 (is_scheduled(FCDBAS) || game.isatb == 1) && !game.iseenit) {
244 /* get attack report from base */
245 prout(_("Lt. Uhura- \"Captain, an important message from the starbase:\""));
252 * This program originally required input in terms of a (clock)
253 * direction and distance. Somewhere in history, it was changed to
254 * cartesian coordinates. So we need to convert. Probably
255 * "manual" input should still be done this way -- it's a real
256 * pain if the computer isn't working! Manual mode is still confusing
257 * because it involves giving x and y motions, yet the coordinates
258 * are always displayed y - x, where +y is downward!
261 static void getcd(bool isprobe, int akey)
262 /* get course and distance */
264 int irowq=game.quadrant.x, icolq=game.quadrant.y, key=0;
265 double xi, xj, xk, xl;
266 double deltax, deltay;
267 enum {unspecified, manual, automatic} navmode = unspecified;
268 enum {curt, normal, verbose} itemp = curt;
270 bool iprompt = false;
272 // Get course direction and distance. If user types bad values, return
273 // with DIREC = -1.0.
276 if (game.landed && !isprobe) {
277 prout(_("Dummy! You can't leave standard orbit until you"));
278 proutn(_("are back aboard the ship."));
282 while (navmode == unspecified) {
283 if (damaged(DNAVSYS)) {
285 prout(_("Computer damaged; manual navigation only"));
287 prout(_("Computer damaged; manual movement only"));
293 if (isprobe && akey != -1) {
294 /* For probe launch, use pre-scanned value first time */
302 proutn(_("Manual or automatic- "));
306 else if (key == IHALPHA) {
307 if (isit("manual")) {
312 else if (isit("automatic")) {
325 prout(_("(Manual navigation assumed.)"));
327 prout(_("(Manual movement assumed.)"));
333 if (navmode == automatic) {
334 while (key == IHEOL) {
336 proutn(_("Target quadrant or quadrant§or- "));
338 proutn(_("Destination sector or quadrant§or- "));
357 /* both quadrant and sector specified */
373 /* only quadrant specified -- go to center of dest quad */
384 if (!VALID_QUADRANT(icolq,irowq)||!VALID_SECTOR(incr.x,incr.y)) {
392 prout(_("Helmsman Sulu- \"Course locked in for %s.\""),
393 cramlc(sector, incr));
397 prout(_("Ensign Chekov- \"Course laid in, Captain.\""));
399 deltax = icolq - game.quadrant.y + 0.1*(incr.x-game.sector.y);
400 deltay = game.quadrant.x - irowq + 0.1*(game.sector.x-incr.y);
403 while (key == IHEOL) {
404 proutn(_("X and Y displacements- "));
422 /* Check for zero movement */
423 if (deltax == 0 && deltay == 0) {
427 if (itemp == verbose && !isprobe) {
429 prout(_("Helmsman Sulu- \"Aye, Sir.\""));
431 game.dist = sqrt(deltax*deltax + deltay*deltay);
432 game.direc = atan2(deltax, deltay)*1.90985932;
433 if (game.direc < 0.0)
442 /* move under impulse power */
447 if (damaged(DIMPULS)) {
450 prout(_("Engineer Scott- \"The impulse engines are damaged, Sir.\""));
454 if (game.energy > 30.0) {
456 if (game.direc == -1.0)
458 power = 20.0 + 100.0*game.dist;
463 if (power >= game.energy) {
464 /* Insufficient power for trip */
466 prout(_("First Officer Spock- \"Captain, the impulse engines"));
467 prout(_("require 20.0 units to engage, plus 100.0 units per"));
468 if (game.energy > 30) {
469 proutn(_("quadrant. We can go, therefore, a maximum of %d"),
470 (int)(0.01 * (game.energy-20.0)-0.05));
471 prout(_(" quadrants.\""));
474 prout(_("quadrant. They are, therefore, useless.\""));
479 /* Make sure enough time is left for the trip */
480 game.optime = game.dist/0.095;
481 if (game.optime >= game.state.remtime) {
482 prout(_("First Officer Spock- \"Captain, our speed under impulse"));
483 prout(_("power is only 0.95 sectors per stardate. Are you sure"));
484 proutn(_("we dare spend the time?\" "));
488 /* Activate impulse engines and pay the cost */
493 power = 20.0 + 100.0*game.dist;
494 game.energy -= power;
495 game.optime = game.dist/0.095;
496 if (game.energy <= 0)
502 void warp(bool timewarp)
503 /* move under warp drive */
506 bool blooey = false, twarp = false;
509 if (!timewarp) { /* Not WARPX entry */
511 if (game.damage[DWARPEN] > 10.0) {
514 prout(_("Engineer Scott- \"The warp engines are damaged, Sir.\""));
517 if (damaged(DWARPEN) && game.warpfac > 4.0) {
520 prout(_("Engineer Scott- \"Sorry, Captain. Until this damage"));
521 prout(_(" is repaired, I can only give you warp 4.\""));
525 /* Read in course and distance */
527 if (game.direc == -1.0)
530 /* Make sure starship has enough energy for the trip */
531 power = (game.dist+0.05)*game.warpfac*game.warpfac*game.warpfac*(game.shldup+1);
534 if (power >= game.energy) {
535 /* Insufficient power for trip */
538 prout(_("Engineering to bridge--"));
539 if (!game.shldup || 0.5*power > game.energy) {
540 iwarp = pow((game.energy/(game.dist+0.05)), 0.333333333);
542 prout(_("We can't do it, Captain. We don't have enough energy."));
545 proutn(_("We don't have enough energy, but we could do it at warp %d"), iwarp);
548 prout(_("if you'll lower the shields."));
555 prout(_("We haven't the energy to go that far with the shields up."));
559 /* Make sure enough time is left for the trip */
560 game.optime = 10.0*game.dist/game.wfacsq;
561 if (game.optime >= 0.8*game.state.remtime) {
563 prout(_("First Officer Spock- \"Captain, I compute that such"));
564 proutn(_(" a trip would require approximately %2.0f"),
565 100.0*game.optime/game.state.remtime);
566 prout(_(" percent of our"));
567 proutn(_(" remaining time. Are you sure this is wise?\" "));
576 if (game.warpfac > 6.0) {
577 /* Decide if engine damage will occur */
578 double prob = game.dist*(6.0-game.warpfac)*(6.0-game.warpfac)/66.666666666;
581 game.dist = Rand()*game.dist;
583 /* Decide if time warp will occur */
584 if (0.5*game.dist*pow(7.0,game.warpfac-10.0) > Rand())
586 if (idebug && game.warpfac==10 && !twarp) {
588 proutn("=== Force time warp? ");
592 if (blooey || twarp) {
593 /* If time warp or engine damage, check path */
594 /* If it is obstructed, don't do warp or damage */
595 double angle = ((15.0-game.direc)*0.5235998);
596 double deltax = -sin(angle);
597 double deltay = cos(angle);
600 if (fabs(deltax) > fabs(deltay))
601 bigger = fabs(deltax);
603 bigger = fabs(deltay);
607 n = 10.0 * game.dist * bigger +0.5;
610 for (l = 1; l <= n; l++) {
615 if (!VALID_SECTOR(ix, iy))
617 if (game.quad[ix][iy] != IHDOT) {
626 /* Activate Warp Engines and pay the cost */
630 game.energy -= game.dist*game.warpfac*game.warpfac*game.warpfac*(game.shldup+1);
631 if (game.energy <= 0)
633 game.optime = 10.0*game.dist/game.wfacsq;
637 game.damage[DWARPEN] = game.damfac*(3.0*Rand()+1.0);
639 prout(_("Engineering to bridge--"));
640 prout(_(" Scott here. The warp engines are damaged."));
641 prout(_(" We'll have to reduce speed to warp 4."));
650 /* change the warp factor */
655 while ((key=scan()) == IHEOL) {
657 proutn(_("Warp factor- "));
664 if (game.damage[DWARPEN] > 10.0) {
665 prout(_("Warp engines inoperative."));
668 if (damaged(DWARPEN) && aaitem > 4.0) {
669 prout(_("Engineer Scott- \"I'm doing my best, Captain,"));
670 prout(_(" but right now we can only go warp 4.\""));
674 prout(_("Helmsman Sulu- \"Our top speed is warp 10, Captain.\""));
678 prout(_("Helmsman Sulu- \"We can't go below warp 1, Captain.\""));
681 oldfac = game.warpfac;
682 game.warpfac = aaitem;
683 game.wfacsq=game.warpfac*game.warpfac;
684 if (game.warpfac <= oldfac || game.warpfac <= 6.0) {
685 prout(_("Helmsman Sulu- \"Warp factor %d, Captain.\""),
689 if (game.warpfac < 8.00) {
690 prout(_("Engineer Scott- \"Aye, but our maximum safe speed is warp 6.\""));
693 if (game.warpfac == 10.0) {
694 prout(_("Engineer Scott- \"Aye, Captain, we'll try it.\""));
697 prout(_("Engineer Scott- \"Aye, Captain, but our engines may not take it.\""));
701 void atover(bool igrab)
702 /* cope with being tossed out of quadrant by supernova or yanked by beam */
704 double power, distreq;
707 /* is captain on planet? */
709 if (damaged(DTRANSP)) {
713 prout(_("Scotty rushes to the transporter controls."));
715 prout(_("But with the shields up it's hopeless."));
718 prouts(_("His desperate attempt to rescue you . . ."));
724 prout(_("SUCCEEDS!"));
727 proutn(_("The crystals mined were "));
728 if (Rand() <= 0.25) {
740 /* Check to see if captain in shuttle craft */
746 /* Inform captain of attempt to reach safety */
750 prouts(_("***RED ALERT! RED ALERT!"));
754 prout(_(" has stopped in a quadrant containing"));
755 prouts(_(" a supernova."));
758 proutn(_("***Emergency automatic override attempts to hurl "));
761 prout(_("safely out of quadrant."));
762 game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = true;
763 /* Try to use warp engines */
764 if (damaged(DWARPEN)) {
766 prout(_("Warp engines damaged."));
770 game.warpfac = 6.0+2.0*Rand();
771 game.wfacsq = game.warpfac * game.warpfac;
772 prout(_("Warp factor set to %d"), (int)game.warpfac);
773 power = 0.75*game.energy;
774 game.dist = power/(game.warpfac*game.warpfac*game.warpfac*(game.shldup+1));
775 distreq = 1.4142+Rand();
776 if (distreq < game.dist)
778 game.optime = 10.0*game.dist/game.wfacsq;
779 game.direc = 12.0*Rand(); /* How dumb! */
781 game.inorbit = false;
784 /* This is bad news, we didn't leave quadrant. */
788 prout(_("Insufficient energy to leave quadrant."));
793 /* Repeat if another snova */
794 (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova);
795 if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0)
796 finish(FWON); /* Snova killed remaining enemy. */
800 /* let's do the time warp again */
804 prout(_("***TIME WARP ENTERED."));
805 if (game.state.snap && Rand() < 0.5) {
806 /* Go back in time */
807 prout(_("You are traveling backwards in time %d stardates."),
808 (int)(game.state.date-game.snapsht.date));
809 game.state = game.snapsht;
810 game.state.snap = false;
811 if (game.state.remcom) {
812 schedule(FTBEAM, expran(game.intime/game.state.remcom));
813 schedule(FBATTAK, expran(0.3*game.intime));
815 schedule(FSNOVA, expran(0.5*game.intime));
816 /* next snapshot will be sooner */
817 schedule(FSNAP, expran(0.25*game.state.remtime));
819 if (game.state.nscrem)
820 schedule(FSCMOVE, 0.2777);
824 invalidate(game.battle);
826 /* Make sure Galileo is consistant -- Snapshot may have been taken
827 when on planet, which would give us two Galileos! */
829 for (l = 0; l < game.inplan; l++) {
830 if (game.state.planets[l].known == shuttle_down) {
832 if (game.iscraft == onship && game.ship==IHE) {
833 prout(_("Checkov- \"Security reports the Galileo has disappeared, Sir!"));
834 game.iscraft = offship;
838 // Likewise, if in the original time the Galileo was abandoned, but
839 // was on ship earlier, it would have vanished -- let's restore it.
840 if (game.iscraft == offship && !gotit && game.damage[DSHUTTL] >= 0.0) {
841 prout(_("Checkov- \"Security reports the Galileo has reappeared in the dock!\""));
842 game.iscraft = onship;
845 * There used to be code to do the actual reconstrction here,
846 * but the starchart is now part of the snapshotted galaxy state.
848 prout(_("Spock has reconstructed a correct star chart from memory"));
851 /* Go forward in time */
852 game.optime = -0.5*game.intime*log(Rand());
853 prout(_("You are traveling forward in time %d stardates."), (int)game.optime);
854 /* cheat to make sure no tractor beams occur during time warp */
855 postpone(FTBEAM, game.optime);
856 game.damage[DRADIO] += game.optime;
859 events(); /* Stas Sergeev added this -- do pending events */
863 /* launch deep-space probe */
865 double angle, bigger;
867 /* New code to launch a deep space probe */
868 if (game.nprobes == 0) {
871 if (game.ship == IHE)
872 prout(_("Engineer Scott- \"We have no more deep space probes, Sir.\""));
874 prout(_("Ye Faerie Queene has no deep space probes."));
880 prout(_("Engineer Scott- \"The probe launcher is damaged, Sir.\""));
883 if (is_scheduled(FDSPROB)) {
886 if (damaged(DRADIO) && game.condition != docked) {
887 prout(_("Spock- \"Records show the previous probe has not yet"));
888 prout(_(" reached its destination.\""));
891 prout(_("Uhura- \"The previous probe is still reporting data, Sir.\""));
897 /* slow mode, so let Kirk know how many probes there are left */
898 prout(game.nprobes==1 ? _("%d probe left.") : _("%d probes left."), game.nprobes);
899 proutn(_("Are you sure you want to fire a probe? "));
904 game.isarmed = false;
905 if (key == IHALPHA && strcmp(citem,"armed") == 0) {
909 else if (key == IHEOL) {
910 proutn(_("Arm NOVAMAX warhead? "));
914 if (game.direc == -1.0)
917 angle = ((15.0 - game.direc) * 0.5235988);
918 game.probeinx = -sin(angle);
919 game.probeiny = cos(angle);
920 if (fabs(game.probeinx) > fabs(game.probeiny))
921 bigger = fabs(game.probeinx);
923 bigger = fabs(game.probeiny);
925 game.probeiny /= bigger;
926 game.probeinx /= bigger;
927 game.proben = 10.0*game.dist*bigger +0.5;
928 game.probex = game.quadrant.x*QUADSIZE + game.sector.x - 1; // We will use better packing than original
929 game.probey = game.quadrant.y*QUADSIZE + game.sector.y - 1;
930 game.probec = game.quadrant;
931 schedule(FDSPROB, 0.01); // Time to move one sector
932 prout(_("Ensign Chekov- \"The deep space probe is launched, Captain.\""));
938 * Here's how the mayday code works:
940 * First, the closest starbase is selected. If there is a
941 * a starbase in your own quadrant, you are in good shape.
942 * This distance takes quadrant distances into account only.
944 * A magic number is computed based on the distance which acts
945 * as the probability that you will be rematerialized. You
948 * When it is determined that you should be able to be remater-
949 * ialized (i.e., when the probability thing mentioned above
950 * comes up positive), you are put into that quadrant (anywhere).
951 * Then, we try to see if there is a spot adjacent to the star-
952 * base. If not, you can't be rematerialized!!! Otherwise,
953 * it drops you there. It only tries five times to find a spot
954 * to drop you. After that, it's your problem.
958 /* yell for help from nearest starbase */
960 /* There's more than one way to move in this game! */
961 double ddist, xdist, probf;
962 int line = 0, m, ix, iy;
965 /* Test for conditions which prevent calling for help */
966 if (game.condition == docked) {
967 prout(_("Lt. Uhura- \"But Captain, we're already docked.\""));
970 if (damaged(DRADIO)) {
971 prout(_("Subspace radio damaged."));
974 if (game.state.rembase==0) {
975 prout(_("Lt. Uhura- \"Captain, I'm not getting any response from Starbase.\""));
979 proutn(_("You must be aboard the "));
984 /* OK -- call for help from nearest starbase */
986 if (game.base.x!=0) {
987 /* There's one in this quadrant */
988 ddist = distance(game.base, game.sector);
992 for (m = 1; m <= game.state.rembase; m++) {
993 xdist = QUADSIZE * distance(game.state.baseq[m], game.quadrant);
999 /* Since starbase not in quadrant, set up new quadrant */
1000 game.quadrant = game.state.baseq[line];
1003 /* dematerialize starship */
1004 game.quad[game.sector.x][game.sector.y]=IHDOT;
1005 proutn(_("Starbase in %s responds--"), cramlc(quadrant, game.quadrant));
1007 prout(_(" dematerializes."));
1009 for (m = 1; m <= 5; m++) {
1010 ix = game.base.x+3.0*Rand()-1;
1011 iy = game.base.y+3.0*Rand()-1;
1012 if (VALID_SECTOR(ix,iy) && game.quad[ix][iy]==IHDOT) {
1013 /* found one -- finish up */
1019 if (!is_valid(game.sector)){
1020 prout(_("You have been lost in space..."));
1021 finish(FMATERIALIZE);
1024 /* Give starbase three chances to rematerialize starship */
1025 probf = pow((1.0 - pow(0.98,ddist)), 0.33333333);
1026 for (m = 1; m <= 3; m++) {
1028 case 1: proutn(_("1st")); break;
1029 case 2: proutn(_("2nd")); break;
1030 case 3: proutn(_("3rd")); break;
1032 proutn(_(" attempt to re-materialize "));
1035 case 1: game.quad[ix][iy]=IHMATER0;
1037 case 2: game.quad[ix][iy]=IHMATER1;
1039 case 3: game.quad[ix][iy]=IHMATER2;
1051 game.quad[ix][iy]=IHQUEST;
1054 setwnd(message_window);
1055 finish(FMATERIALIZE);
1058 game.quad[ix][iy]=game.ship;
1060 prout(_("succeeds."));
1064 prout(_("Lt. Uhura- \"Captain, we made it!\""));
1070 * The ship is abandoned. If your current ship is the Faire
1071 * Queene, or if your shuttlecraft is dead, you're out of
1072 * luck. You need the shuttlecraft in order for the captain
1073 * (that's you!!) to escape.
1075 * Your crew can beam to an inhabited starsystem in the
1076 * quadrant, if there is one and if the transporter is working.
1077 * If there is no inhabited starsystem, or if the transporter
1078 * is out, they are left to die in outer space.
1080 * If there are no starbases left, you are captured by the
1081 * Klingons, who torture you mercilessly. However, if there
1082 * is at least one starbase, you are returned to the
1083 * Federation in a prisoner of war exchange. Of course, this
1084 * can't happen unless you have taken some prisoners.
1095 if (game.condition==docked) {
1096 if (game.ship!=IHE) {
1097 prout(_("You cannot abandon Ye Faerie Queene."));
1102 /* Must take shuttle craft to exit */
1103 if (game.damage[DSHUTTL]==-1) {
1104 prout(_("Ye Faerie Queene has no shuttle craft."));
1107 if (game.damage[DSHUTTL]<0) {
1108 prout(_("Shuttle craft now serving Big Macs."));
1111 if (game.damage[DSHUTTL]>0) {
1112 prout(_("Shuttle craft damaged."));
1116 prout(_("You must be aboard the ship."));
1119 if (game.iscraft != onship) {
1120 prout(_("Shuttle craft not currently available."));
1123 /* Print abandon ship messages */
1125 prouts(_("***ABANDON SHIP! ABANDON SHIP!"));
1127 prouts(_("***ALL HANDS ABANDON SHIP!"));
1129 prout(_("Captain and crew escape in shuttle craft."));
1130 if (game.state.rembase==0) {
1131 /* Oops! no place to go... */
1135 q = &game.state.galaxy[game.quadrant.x][game.quadrant.y];
1136 /* Dispose of crew */
1137 if (!(game.options & OPTION_WORLDS) && !damaged(DTRANSP)) {
1138 prout(_("Remainder of ship's complement beam down"));
1139 prout(_("to nearest habitable planet."));
1140 } else if (q->planet != NOPLANET && !damaged(DTRANSP)) {
1141 prout(_("Remainder of ship's complement beam down to %s."),
1142 systnames[q->planet]);
1144 prout(_("Entire crew of %d left to die in outer space."),
1146 game.casual += game.state.crew;
1147 game.abandoned += game.state.crew;
1150 /* If at least one base left, give 'em the Faerie Queene */
1152 game.icrystl = false; /* crystals are lost */
1153 game.nprobes = 0; /* No probes */
1154 prout(_("You are captured by Klingons and released to"));
1155 prout(_("the Federation in a prisoner-of-war exchange."));
1156 nb = Rand()*game.state.rembase+1;
1157 /* Set up quadrant and position FQ adjacient to base */
1158 if (!same(game.quadrant, game.state.baseq[nb])) {
1159 game.quadrant = game.state.baseq[nb];
1160 game.sector.x = game.sector.y = 5;
1164 /* position next to base by trial and error */
1165 game.quad[game.sector.x][game.sector.y] = IHDOT;
1166 for (l = 1; l <= QUADSIZE; l++) {
1167 game.sector.x = 3.0*Rand() - 1.0 + game.base.x;
1168 game.sector.y = 3.0*Rand() - 1.0 + game.base.y;
1169 if (VALID_SECTOR(game.sector.x, game.sector.y) &&
1170 game.quad[game.sector.x][game.sector.y] == IHDOT) break;
1173 break; /* found a spot */
1174 game.sector.x=QUADSIZE/2;
1175 game.sector.y=QUADSIZE/2;
1179 /* Get new commission */
1180 game.quad[game.sector.x][game.sector.y] = game.ship = IHF;
1181 game.state.crew = FULLCREW;
1182 prout(_("Starfleet puts you in command of another ship,"));
1183 prout(_("the Faerie Queene, which is antiquated but,"));
1184 prout(_("still useable."));
1186 prout(_("The dilithium crystals have been moved."));
1188 game.iscraft = offship; /* Galileo disappears */
1190 game.condition=docked;
1191 for (l = 0; l < NDEVICES; l++)
1192 game.damage[l] = 0.0;
1193 game.damage[DSHUTTL] = -1;
1194 game.energy = game.inenrg = 3000.0;
1195 game.shield = game.inshld = 1250.0;
1196 game.torps = game.intorps = 6;
1197 game.lsupres=game.inlsr=3.0;