4 event *unschedule(int evtype)
5 /* remove an event from the schedule */
7 game.future[evtype].date = FOREVER;
8 return &game.future[evtype];
11 int is_scheduled(int evtype)
12 /* is an event of specified type scheduled */
14 return game.future[evtype].date != FOREVER;
17 extern double scheduled(int evtype)
18 /* when will this event happen? */
20 return game.future[evtype].date;
23 event *schedule(int evtype, double offset)
24 /* schedule an event of specified type */
26 game.future[evtype].date = game.state.date + offset;
27 return &game.future[evtype];
30 void postpone(int evtype, double offset)
31 /* poistpone a scheduled event */
33 game.future[evtype].date += offset;
36 static bool cancelrest(void)
40 proutn(_("Mr. Spock- \"Captain, shall we cancel the rest period?\""));
53 int ictbeam=0, ipage=0, istract=0, line, i=0, j, k, l, ixhold=0, iyhold=0;
54 double fintim = game.state.date + game.optime, datemin, xtime, repair, yank=0;
56 struct quadrant *pdest, *q;
61 prout("=== EVENTS from %.2f to %.2f:", game.state.date, fintim);
62 for (i = 1; i < NEVENTS; i++) {
64 case FSNOVA: proutn("=== Supernova "); break;
65 case FTBEAM: proutn("=== T Beam "); break;
66 case FSNAP: proutn("=== Snapshot "); break;
67 case FBATTAK: proutn("=== Base Attack "); break;
68 case FCDBAS: proutn("=== Base Destroy "); break;
69 case FSCMOVE: proutn("=== SC Move "); break;
70 case FSCDBAS: proutn("=== SC Base Destroy "); break;
71 case FDSPROB: proutn("=== Probe Move "); break;
72 case FDISTR: proutn("=== Distress Call "); break;
73 case FENSLV: proutn("=== Enlavement "); break;
74 case FREPRO: proutn("=== Klingon Build "); break;
77 prout("%.2f", scheduled(i));
84 radio_was_broken = (game.damage[DRADIO] != 0.0);
87 /* Select earliest extraneous event, line==0 if no events */
89 if (game.alldone) return;
91 for (l = 1; l < NEVENTS; l++)
92 if (game.future[l].date < datemin) {
95 prout("== Event %d fires", line);
96 datemin = game.future[l].date;
98 xtime = datemin-game.state.date;
99 game.state.date = datemin;
100 /* Decrement Federation resources and recompute remaining time */
101 game.state.remres -= (game.state.remkl+4*game.state.remcom)*xtime;
102 game.state.remtime = game.state.remres/(game.state.remkl+4*game.state.remcom);
103 if (game.state.remtime <=0) {
107 /* Is life support adequate? */
108 if (game.damage[DLIFSUP] && game.condit != IHDOCKED) {
109 if (game.lsupres < xtime && game.damage[DLIFSUP] > game.lsupres) {
113 game.lsupres -= xtime;
114 if (game.damage[DLIFSUP] <= xtime) game.lsupres = game.inlsr;
118 if (game.condit == IHDOCKED) repair /= game.docfac;
119 /* Don't fix Deathray here */
120 for (l=0; l<NDEVICES; l++)
121 if (game.damage[l] > 0.0 && l != DDRAY)
122 game.damage[l] -= (game.damage[l]-repair > 0.0 ? repair : game.damage[l]);
123 /* If radio repaired, update star chart and attack reports */
124 if (radio_was_broken && game.damage[DRADIO] == 0.0) {
125 prout(_("Lt. Uhura- \"Captain, the sub-space radio is working and"));
126 prout(_(" surveillance reports are coming in."));
128 if (game.iseenit==0) {
133 prout(_(" The star chart is now up to date.\""));
136 /* Cause extraneous event LINE to occur */
137 game.optime -= xtime;
139 case FSNOVA: /* Supernova */
140 if (ipage==0) pause_game(1);
143 schedule(FSNOVA, expran(0.5*game.intime));
144 if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova) return;
146 case FSPY: /* Check with spy to see if S.C. should tractor beam */
147 if (game.state.nscrem == 0 ||
148 ictbeam+istract > 0 ||
149 game.condit==IHDOCKED || game.isatb==1 || game.iscate==1) return;
151 (game.energy < 2000 && game.torps < 4 && game.shield < 1250) ||
152 (game.damage[DPHASER]>0 && (game.damage[DPHOTON]>0 || game.torps < 4)) ||
153 (game.damage[DSHIELD] > 0 &&
154 (game.energy < 2500 || game.damage[DPHASER] > 0) &&
155 (game.torps < 5 || game.damage[DPHOTON] > 0))) {
156 /* Tractor-beam her! */
158 yank = square(game.state.kscmdr.x-game.quadrant.x) + square(game.state.kscmdr.y-game.quadrant.y);
159 /********* fall through to FTBEAM code ***********/
162 case FTBEAM: /* Tractor beam */
164 if (game.state.remcom == 0) {
168 i = Rand()*game.state.remcom+1.0;
169 yank = square(game.state.kcmdr[i].x-game.quadrant.x) + square(game.state.kcmdr[i].y-game.quadrant.y);
170 if (istract || game.condit == IHDOCKED || yank == 0) {
171 /* Drats! Have to reschedule */
173 game.optime + expran(1.5*game.intime/game.state.remcom));
177 /* tractor beaming cases merge here */
179 if (ipage==0) pause_game(1);
181 game.optime = (10.0/(7.5*7.5))*yank; /* 7.5 is yank rate (warp 7.5) */
186 prout(_(" caught in long range tractor beam--"));
187 /* If Kirk & Co. screwing around on planet, handle */
188 atover(1); /* atover(1) is Grab */
189 if (game.alldone) return;
190 if (game.icraft == 1) { /* Caught in Galileo? */
194 /* Check to see if shuttle is aboard */
195 if (game.iscraft==0) {
198 prout(_("Galileo, left on the planet surface, is captured"));
199 prout(_("by aliens and made into a flying McDonald's."));
200 game.damage[DSHUTTL] = -10;
204 prout(_("Galileo, left on the planet surface, is well hidden."));
208 game.quadrant = game.state.kscmdr;
210 game.quadrant = game.state.kcmdr[i];
211 iran(QUADSIZE, &game.sector.x, &game.sector.y);
213 proutn(_(" is pulled to "));
214 proutn(cramlc(quadrant, game.quadrant));
216 prout(cramlc(sector, game.sector));
218 prout(_("(Remainder of rest/repair period cancelled.)"));
219 game.resting = false;
222 if (game.damage[DSHIELD]==0 && game.shield > 0) {
223 doshield(2); /* Shldsup */
226 else prout(_("(Shields not currently useable.)"));
229 /* Adjust finish time to time of tractor beaming */
230 fintim = game.state.date+game.optime;
232 if (game.state.remcom <= 0) unschedule(FTBEAM);
233 else schedule(FTBEAM, game.optime+expran(1.5*game.intime/game.state.remcom));
235 case FSNAP: /* Snapshot of the universe (for time warp) */
236 game.snapsht = game.state;
238 schedule(FSNAP, expran(0.5 * game.intime));
240 case FBATTAK: /* Commander attacks starbase */
241 if (game.state.remcom==0 || game.state.rembase==0) {
250 if (same(game.state.baseq[j], game.state.kcmdr[k]) &&
251 !same(game.state.baseq[j], game.quadrant) &&
252 !same(game.state.baseq[j], game.state.kscmdr)) {
258 if (j>game.state.rembase) {
259 /* no match found -- try later */
260 schedule(FBATTAK, expran(0.3*game.intime));
264 /* commander + starbase combination found -- launch attack */
265 game.battle = game.state.baseq[j];
266 schedule(FCDBAS, 1.0+3.0*Rand());
267 if (game.isatb) /* extra time if SC already attacking */
268 postpone(FCDBAS, scheduled(FSCDBAS)-game.state.date);
269 game.future[FBATTAK].date = game.future[FCDBAS].date + expran(0.3*game.intime);
271 if (game.damage[DRADIO] != 0.0 && game.condit != IHDOCKED)
272 break; /* No warning :-( */
274 if (ipage==0) pause_game(1);
277 proutn(_("Lt. Uhura- \"Captain, the starbase in "));
278 prout(cramlc(quadrant, game.battle));
279 prout(_(" reports that it is under attack and that it can"));
280 proutn(_(" hold out only until stardate %d"),
281 (int)scheduled(FCDBAS));
286 case FSCDBAS: /* Supercommander destroys base */
289 if (!game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].starbase)
290 break; /* WAS RETURN! */
291 ixhold = game.battle.x;
292 iyhold = game.battle.y;
293 game.battle = game.state.kscmdr;
295 case FCDBAS: /* Commander succeeds in destroying base */
298 /* find the lucky pair */
300 if (same(game.state.kcmdr[i], game.battle))
302 if (i > game.state.remcom || game.state.rembase == 0 ||
303 !game.state.galaxy[game.battle.x][game.battle.y].starbase) {
304 /* No action to take after all */
305 game.battle.x = game.battle.y = 0;
309 /* Code merges here for any commander destroying base */
310 /* Not perfect, but will have to do */
311 /* Handle case where base is in same quadrant as starship */
312 if (same(game.battle, game.quadrant)) {
313 game.state.chart[game.battle.x][game.battle.y].starbase = false;
314 game.quad[game.base.x][game.base.y] = IHDOT;
315 game.base.x=game.base.y=0;
318 prout(_("Spock- \"Captain, I believe the starbase has been destroyed.\""));
320 else if (game.state.rembase != 1 &&
321 (game.damage[DRADIO] <= 0.0 || game.condit == IHDOCKED)) {
322 /* Get word via subspace radio */
323 if (ipage==0) pause_game(1);
326 prout(_("Lt. Uhura- \"Captain, Starfleet Command reports that"));
327 proutn(_(" the starbase in "));
328 proutn(cramlc(quadrant, game.battle));
329 prout(_(" has been destroyed by"));
331 prout(_("the Klingon Super-Commander"));
332 else prout(_("a Klingon Commander"));
333 game.state.chart[game.battle.x][game.battle.y].starbase = false;
335 /* Remove Starbase from galaxy */
336 game.state.galaxy[game.battle.x][game.battle.y].starbase = false;
338 if (same(game.state.baseq[i], game.battle))
339 game.state.baseq[i] = game.state.baseq[game.state.rembase];
340 game.state.rembase--;
341 if (game.isatb == 2) {
342 /* reinstate a commander's base attack */
343 game.battle.x = ixhold;
344 game.battle.y = iyhold;
348 game.battle.x = game.battle.y = 0;
351 case FSCMOVE: /* Supercommander moves */
352 schedule(FSCMOVE, 0.2777);
353 if (game.ientesc+istract==0 &&
355 (game.iscate != 1 || !game.justin)) scom(&ipage);
357 case FDSPROB: /* Move deep space probe */
358 schedule(FDSPROB, 0.01);
359 game.probex += game.probeinx;
360 game.probey += game.probeiny;
361 i = (int)(game.probex/QUADSIZE +0.05);
362 j = (int)(game.probey/QUADSIZE + 0.05);
363 if (game.probec.x != i || game.probec.y != j) {
366 if (!VALID_QUADRANT(i, j) ||
367 game.state.galaxy[game.probec.x][game.probec.y].supernova) {
368 // Left galaxy or ran into supernova
369 if (game.damage[DRADIO]==0.0 || game.condit == IHDOCKED) {
370 if (ipage==0) pause_game(1);
373 proutn(_("Lt. Uhura- \"The deep space probe "));
374 if (!VALID_QUADRANT(j, i))
375 proutn(_("has left the galaxy"));
377 proutn(_("is no longer transmitting"));
383 if (game.damage[DRADIO]==0.0 || game.condit == IHDOCKED) {
384 if (ipage==0) pause_game(1);
387 proutn(_("Lt. Uhura- \"The deep space probe is now in "));
388 proutn(cramlc(quadrant, game.probec));
392 pdest = &game.state.galaxy[game.probec.x][game.probec.y];
393 /* Update star chart if Radio is working or have access to
395 if (game.damage[DRADIO] == 0.0 || game.condit == IHDOCKED) {
396 struct page *chp = &game.state.chart[game.probec.x][game.probec.y];
398 chp->klingons = pdest->klingons;
399 chp->starbase = pdest->starbase;
400 chp->stars = pdest->stars;
401 pdest->charted = true;
403 game.proben--; // One less to travel
404 if (game.proben == 0 && game.isarmed && pdest->stars) {
405 /* lets blow the sucker! */
408 if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova)
412 case FDISTR: /* inhabited system issues distress call */
414 /* try a whole bunch of times to find something suitable */
417 /* need a quadrant which is not the current one,
418 which has some stars which are inhabited and
419 not already under attack, which is not
420 supernova'ed, and which has some Klingons in it */
421 iran(GALSIZE, &w.x, &w.y);
422 q = &game.state.galaxy[w.x][w.y];
424 (same(game.quadrant, w) || q->planet == NOPLANET ||
425 q->supernova || q->status!=secure || q->klingons<=0));
427 /* can't seem to find one; ignore this call */
429 prout("=== Couldn't find location for distress event.");
433 /* got one!! Schedule its enslavement */
434 ev = schedule(FENSLV, expran(game.intime));
436 q->status = distressed;
438 /* tell the captain about it if we can */
439 if (game.damage[DRADIO] == 0.0 || game.condit == IHDOCKED)
441 prout("Uhura: Captain, starsystem %s in quadrant %d - %d is under attack.",
442 systemname(q->planet), w.x, w.y);
447 case FENSLV: /* starsystem is enslaved */
448 ev = unschedule(FENSLV);
449 /* see if current distress call still active */
450 q = &game.state.galaxy[ev->quadrant.x][ev->quadrant.y];
451 if (q->klingons <= 0) {
455 q->status = enslaved;
457 /* play stork and schedule the first baby */
458 ev = schedule(FREPRO, expran(2.0 * game.intime));
460 /* report the disaster if we can */
461 if (game.damage[DRADIO] == 0.0 || game.condit == IHDOCKED)
463 prout("\nUhura: We've lost contact with starsystem %s\n",
464 systemname(q->planet));
465 prout(" in quadrant %d,%d.\n", ev->quadrant.x,ev->quadrant.y);
468 case FREPRO: /* Klingon reproduces */
469 ev = schedule(FREPRO, expran(1.0 * game.intime));
470 /* see if current distress call still active */
471 q = &game.state.galaxy[ev->quadrant.x][ev->quadrant.y];
472 if (q->klingons <= 0) {
476 /* reproduce one Klingon */
478 if (game.state.remkl >=MAXKLGAME)
479 break; /* full right now */
480 /* this quadrant not ok, pick an adjacent one */
481 for (i = w.x - 1; i <= w.x + 1; i++)
483 for (j = w.y - 1; j <= w.y + 1; j++)
485 if (!VALID_QUADRANT(i, j))
487 q = &game.state.galaxy[w.x][w.y];
488 /* check for this quad ok (not full & no snova) */
489 if (q->klingons >= MAXKLQUAD || !q->supernova)
494 break; /* search for eligible quadrant failed */
499 /* deliver the child */
502 if (same(game.quadrant, w))
503 newkling(++game.klhere, &hold);
505 /* recompute time left */
506 game.state.remtime = game.state.remres/(game.state.remkl+4*game.state.remcom);
516 double temp, delay, origTime;
521 if (key != IHEOL) break;
522 proutn(_("How long? "));
529 origTime = delay = aaitem;
530 if (delay <= 0.0) return;
531 if (delay >= game.state.remtime || game.nenhere != 0) {
532 proutn(_("Are you sure? "));
533 if (ja() == 0) return;
536 /* Alternate resting periods (events) with attacks */
540 if (delay <= 0) game.resting = false;
542 prout(_("%d stardates left."), (int)game.state.remtime);
545 temp = game.optime = delay;
548 double rtime = 1.0 + Rand();
549 if (rtime < temp) temp = rtime;
552 if (game.optime < delay) attack(0);
553 if (game.alldone) return;
556 if (game.alldone) return;
558 /* Repair Deathray if long rest at starbase */
559 if (origTime-delay >= 9.99 && game.condit == IHDOCKED)
560 game.damage[DDRAY] = 0.0;
562 // leave if quadrant supernovas
563 (!game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova);
565 game.resting = false;
569 void nova(int ix, int iy)
571 static double course[] =
572 {0.0, 10.5, 12.0, 1.5, 9.0, 0.0, 3.0, 7.5, 6.0, 4.5};
573 int bot, top, top2, hits[QUADSIZE+1][3], kount, icx, icy, mm, nn, j;
574 int iquad, iquad1, i, ll;
575 coord newc, nov, scratch;
577 nov.x = ix; nov.y = iy;
579 /* Wow! We've supernova'ed */
584 /* handle initial nova */
585 game.quad[ix][iy] = IHDOT;
586 crmena(1, IHSTAR, 2, nov);
588 game.state.galaxy[game.quadrant.x][game.quadrant.y].stars--;
591 /* Set up stack to recursively trigger adjacent stars */
592 bot = top = top2 = 1;
598 for (mm = bot; mm <= top; mm++)
599 for (nn = 1; nn <= 3; nn++) /* nn,j represents coordinates around current */
600 for (j = 1; j <= 3; j++) {
601 if (j==2 && nn== 2) continue;
602 scratch.x = hits[mm][1]+nn-2;
603 scratch.y = hits[mm][2]+j-2;
604 if (!VALID_SECTOR(scratch.y, scratch.x)) continue;
605 iquad = game.quad[scratch.x][scratch.y];
607 // case IHDOT: /* Empty space ends reaction
614 case IHSTAR: /* Affect another star */
616 /* This star supernovas */
617 snova(scratch.x,scratch.y);
621 hits[top2][1]=scratch.x;
622 hits[top2][2]=scratch.y;
623 game.state.galaxy[game.quadrant.x][game.quadrant.y].stars -= 1;
625 crmena(1, IHSTAR, 2, scratch);
627 game.quad[scratch.x][scratch.y] = IHDOT;
629 case IHP: /* Destroy planet */
630 game.state.galaxy[game.quadrant.x][game.quadrant.y].planet = NOPLANET;
631 game.state.nplankl++;
632 crmena(1, IHP, 2, scratch);
633 prout(_(" destroyed."));
634 DESTROY(&game.state.plnets[game.iplnet]);
635 game.iplnet = game.plnet.x = game.plnet.y = 0;
636 if (game.landed == 1) {
640 game.quad[scratch.x][scratch.y] = IHDOT;
642 case IHB: /* Destroy base */
643 game.state.galaxy[game.quadrant.x][game.quadrant.y].starbase = false;
645 if (game.state.baseq[i].x==game.quadrant.x && game.state.baseq[i].y==game.quadrant.y)
647 game.state.baseq[i] = game.state.baseq[game.state.rembase];
648 game.state.rembase--;
649 game.base.x = game.base.y = 0;
652 crmena(1, IHB, 2, scratch);
653 prout(_(" destroyed."));
654 game.quad[scratch.x][scratch.y] = IHDOT;
656 case IHE: /* Buffet ship */
658 prout(_("***Starship buffeted by nova."));
660 if (game.shield >= 2000.0) game.shield -= 2000.0;
662 double diff = 2000.0 - game.shield;
666 prout(_("***Shields knocked out."));
667 game.damage[DSHIELD] += 0.005*game.damfac*Rand()*diff;
670 else game.energy -= 2000.0;
671 if (game.energy <= 0) {
675 /* add in course nova contributes to kicking starship*/
676 icx += game.sector.x-hits[mm][1];
677 icy += game.sector.y-hits[mm][2];
680 case IHK: /* kill klingon */
681 deadkl(scratch,iquad, scratch.x, scratch.y);
683 case IHC: /* Damage/destroy big enemies */
686 for_local_enemies(ll)
687 if (game.ks[ll].x==scratch.x && game.ks[ll].y==scratch.y) break;
688 game.kpower[ll] -= 800.0; /* If firepower is lost, die */
689 if (game.kpower[ll] <= 0.0) {
690 deadkl(scratch, iquad, scratch.x, scratch.y);
693 newc.x = scratch.x + scratch.x - hits[mm][1];
694 newc.y = scratch.y + scratch.y - hits[mm][2];
695 crmena(1, iquad, 2, scratch);
696 proutn(_(" damaged"));
697 if (!VALID_SECTOR(newc.x, newc.y)) {
698 /* can't leave quadrant */
702 iquad1 = game.quad[newc.x][newc.y];
703 if (iquad1 == IHBLANK) {
704 proutn(_(", blasted into "));
705 crmena(0, IHBLANK, 2, newc);
707 deadkl(scratch, iquad, newc.x, newc.y);
710 if (iquad1 != IHDOT) {
711 /* can't move into something else */
715 proutn(_(", buffeted to "));
716 proutn(cramlc(sector, newc));
717 game.quad[scratch.x][scratch.y] = IHDOT;
718 game.quad[newc.x][newc.y] = iquad;
719 game.ks[ll].x = newc.x;
720 game.ks[ll].y = newc.y;
721 game.kavgd[ll] = sqrt(square(game.sector.x-newc.x)+square(game.sector.y-newc.y));
722 game.kdist[ll] = game.kavgd[ll];
735 /* Starship affected by nova -- kick it away. */
736 game.dist = kount*0.1;
737 if (icx) icx = (icx < 0 ? -1 : 1);
738 if (icy) icy = (icy < 0 ? -1 : 1);
739 game.direc = course[3*(icx+1)+icy+2];
740 if (game.direc == 0.0) game.dist = 0.0;
741 if (game.dist == 0.0) return;
742 game.optime = 10.0*game.dist/16.0;
744 prout(_("Force of nova displaces starship."));
745 game.iattak=2; /* Eliminates recursion problem */
747 game.optime = 10.0*game.dist/16.0;
752 void snova(int insx, int insy)
754 int comdead, nsx, nsy, num=0, kldead, iscdead;
765 /* NOVAMAX being used */
769 /* Scheduled supernova -- select star */
770 /* logic changed here so that we won't favor quadrants in top
772 for_quadrants(nq.x) {
773 for_quadrants(nq.y) {
774 stars += game.state.galaxy[nq.x][nq.y].stars;
777 if (stars == 0) return; /* nothing to supernova exists */
778 num = Rand()*stars + 1;
779 for_quadrants(nq.x) {
780 for_quadrants(nq.y) {
781 num -= game.state.galaxy[nq.x][nq.y].stars;
787 proutn("=== Super nova here?");
789 nq.x = game.quadrant.x;
790 nq.y = game.quadrant.y;
795 if (nq.x != game.quadrant.y || nq.y != game.quadrant.y || game.justin != 0) {
796 /* it isn't here, or we just entered (treat as inroute) */
797 if (game.damage[DRADIO] == 0.0 || game.condit == IHDOCKED) {
799 prout(_("Message from Starfleet Command Stardate %.2f"), game.state.date);
800 prout(_(" Supernova in %s; caution advised."),
801 cramlc(quadrant, nq));
805 /* we are in the quadrant! */
807 num = Rand()* game.state.galaxy[nq.x][nq.y].stars + 1;
810 if (game.quad[nsx][nsy]==IHSTAR) {
826 prouts(_("***RED ALERT! RED ALERT!"));
828 nd.x = nsx; nd.y = nsy;
829 prout(_("***Incipient supernova detected at "), cramlc(sector, nd));
831 if (square(nsx-game.sector.x) + square(nsy-game.sector.y) <= 2.1) {
832 proutn(_("Emergency override attempts t"));
833 prouts("***************");
839 /* destroy any Klingons in supernovaed quadrant */
840 kldead = game.state.galaxy[nq.x][nq.y].klingons;
841 game.state.galaxy[nq.x][nq.y].klingons = 0;
842 comdead = iscdead = 0;
843 if (same(nq, game.state.kscmdr)) {
844 /* did in the Supercommander! */
845 game.state.nscrem = game.state.kscmdr.x = game.state.kscmdr.y = game.isatb = game.iscate = 0;
850 if (game.state.remcom) {
851 int maxloop = game.state.remcom, l;
852 for (l = 1; l <= maxloop; l++) {
853 if (same(game.state.kcmdr[l], nq)) {
854 game.state.kcmdr[l] = game.state.kcmdr[game.state.remcom];
855 game.state.kcmdr[game.state.remcom].x = game.state.kcmdr[game.state.remcom].y = 0;
859 if (game.state.remcom==0) unschedule(FTBEAM);
864 game.state.remkl -= kldead;
865 /* destroy Romulans and planets in supernovaed quadrant */
866 nrmdead = game.state.galaxy[nq.x][nq.y].romulans;
867 game.state.galaxy[nq.x][nq.y].romulans = 0;
868 game.state.nromrem -= nrmdead;
869 npdead = num - nrmdead*10;
872 for (l = 0; l < game.inplan; l++)
873 if (same(game.state.plnets[l].w, nq)) {
874 DESTROY(&game.state.plnets[l]);
877 /* Destroy any base in supernovaed quadrant */
878 if (game.state.rembase) {
879 int maxloop = game.state.rembase, l;
880 for (l = 1; l <= maxloop; l++)
881 if (same(game.state.baseq[l], nq)) {
882 game.state.baseq[l] = game.state.baseq[game.state.rembase];
883 game.state.baseq[game.state.rembase].x = game.state.baseq[game.state.rembase].y = 0;
884 game.state.rembase--;
888 /* If starship caused supernova, tally up destruction */
890 game.state.starkl += game.state.galaxy[nq.x][nq.y].stars;
891 game.state.basekl += game.state.galaxy[nq.x][nq.y].starbase;
892 game.state.nplankl += npdead;
894 /* mark supernova in galaxy and in star chart */
895 if ((game.quadrant.x == nq.x && game.quadrant.y == nq.y) ||
896 game.damage[DRADIO] == 0 ||
897 game.condit == IHDOCKED)
898 game.state.galaxy[nq.x][nq.y].supernova = true;
899 /* If supernova destroys last klingons give special message */
900 if (KLINGREM==0 && (nq.x != game.quadrant.x || nq.y != game.quadrant.y)) {
902 if (insx == 0) prout(_("Lucky you!"));
903 proutn(_("A supernova in %s has just destroyed the last Klingons."),
904 cramlc(quadrant, nq));
908 /* if some Klingons remain, continue or die in supernova */
909 if (game.alldone) finish(FSNOVAED);