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 */
413 schedule(FDISTR, expran(0.5*game.intime));
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 prout("=== Distress call set at %d, %d.", w.x, w.y);
440 /* tell the captain about it if we can */
441 if (game.damage[DRADIO] == 0.0 || game.condit == IHDOCKED)
443 prout("Uhura: Captain, starsystem %s in quadrant %d - %d is under attack.",
444 systemname(q->planet), w.x, w.y);
449 case FENSLV: /* starsystem is enslaved */
450 ev = unschedule(FENSLV);
451 /* see if current distress call still active */
452 q = &game.state.galaxy[ev->quadrant.x][ev->quadrant.y];
453 if (q->klingons <= 0) {
457 q->status = enslaved;
459 /* play stork and schedule the first baby */
460 ev = schedule(FREPRO, expran(2.0 * game.intime));
462 /* report the disaster if we can */
463 if (game.damage[DRADIO] == 0.0 || game.condit == IHDOCKED)
465 prout("\nUhura: We've lost contact with starsystem %s\n",
466 systemname(q->planet));
467 prout(" in quadrant %d,%d.\n", ev->quadrant.x,ev->quadrant.y);
470 case FREPRO: /* Klingon reproduces */
471 ev = schedule(FREPRO, expran(1.0 * game.intime));
472 /* see if current distress call still active */
473 q = &game.state.galaxy[ev->quadrant.x][ev->quadrant.y];
474 if (q->klingons <= 0) {
478 /* reproduce one Klingon */
480 if (game.state.remkl >=MAXKLGAME)
481 break; /* full right now */
482 /* this quadrant not ok, pick an adjacent one */
483 for (i = w.x - 1; i <= w.x + 1; i++)
485 for (j = w.y - 1; j <= w.y + 1; j++)
487 if (!VALID_QUADRANT(i, j))
489 q = &game.state.galaxy[w.x][w.y];
490 /* check for this quad ok (not full & no snova) */
491 if (q->klingons >= MAXKLQUAD || !q->supernova)
496 break; /* search for eligible quadrant failed */
501 /* deliver the child */
504 if (same(game.quadrant, w))
505 newkling(++game.klhere, &hold);
507 /* recompute time left */
508 game.state.remtime = game.state.remres/(game.state.remkl+4*game.state.remcom);
518 double temp, delay, origTime;
523 if (key != IHEOL) break;
524 proutn(_("How long? "));
531 origTime = delay = aaitem;
532 if (delay <= 0.0) return;
533 if (delay >= game.state.remtime || game.nenhere != 0) {
534 proutn(_("Are you sure? "));
535 if (ja() == 0) return;
538 /* Alternate resting periods (events) with attacks */
542 if (delay <= 0) game.resting = false;
544 prout(_("%d stardates left."), (int)game.state.remtime);
547 temp = game.optime = delay;
550 double rtime = 1.0 + Rand();
551 if (rtime < temp) temp = rtime;
554 if (game.optime < delay) attack(0);
555 if (game.alldone) return;
558 if (game.alldone) return;
560 /* Repair Deathray if long rest at starbase */
561 if (origTime-delay >= 9.99 && game.condit == IHDOCKED)
562 game.damage[DDRAY] = 0.0;
564 // leave if quadrant supernovas
565 (!game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova);
567 game.resting = false;
571 void nova(int ix, int iy)
573 static double course[] =
574 {0.0, 10.5, 12.0, 1.5, 9.0, 0.0, 3.0, 7.5, 6.0, 4.5};
575 int bot, top, top2, hits[QUADSIZE+1][3], kount, icx, icy, mm, nn, j;
576 int iquad, iquad1, i, ll;
577 coord newc, nov, scratch;
579 nov.x = ix; nov.y = iy;
581 /* Wow! We've supernova'ed */
586 /* handle initial nova */
587 game.quad[ix][iy] = IHDOT;
588 crmena(1, IHSTAR, 2, nov);
590 game.state.galaxy[game.quadrant.x][game.quadrant.y].stars--;
593 /* Set up stack to recursively trigger adjacent stars */
594 bot = top = top2 = 1;
600 for (mm = bot; mm <= top; mm++)
601 for (nn = 1; nn <= 3; nn++) /* nn,j represents coordinates around current */
602 for (j = 1; j <= 3; j++) {
603 if (j==2 && nn== 2) continue;
604 scratch.x = hits[mm][1]+nn-2;
605 scratch.y = hits[mm][2]+j-2;
606 if (!VALID_SECTOR(scratch.y, scratch.x)) continue;
607 iquad = game.quad[scratch.x][scratch.y];
609 // case IHDOT: /* Empty space ends reaction
616 case IHSTAR: /* Affect another star */
618 /* This star supernovas */
619 snova(scratch.x,scratch.y);
623 hits[top2][1]=scratch.x;
624 hits[top2][2]=scratch.y;
625 game.state.galaxy[game.quadrant.x][game.quadrant.y].stars -= 1;
627 crmena(1, IHSTAR, 2, scratch);
629 game.quad[scratch.x][scratch.y] = IHDOT;
631 case IHP: /* Destroy planet */
632 game.state.galaxy[game.quadrant.x][game.quadrant.y].planet = NOPLANET;
633 game.state.nplankl++;
634 crmena(1, IHP, 2, scratch);
635 prout(_(" destroyed."));
636 DESTROY(&game.state.plnets[game.iplnet]);
637 game.iplnet = game.plnet.x = game.plnet.y = 0;
638 if (game.landed == 1) {
642 game.quad[scratch.x][scratch.y] = IHDOT;
644 case IHB: /* Destroy base */
645 game.state.galaxy[game.quadrant.x][game.quadrant.y].starbase = false;
647 if (game.state.baseq[i].x==game.quadrant.x && game.state.baseq[i].y==game.quadrant.y)
649 game.state.baseq[i] = game.state.baseq[game.state.rembase];
650 game.state.rembase--;
651 game.base.x = game.base.y = 0;
654 crmena(1, IHB, 2, scratch);
655 prout(_(" destroyed."));
656 game.quad[scratch.x][scratch.y] = IHDOT;
658 case IHE: /* Buffet ship */
660 prout(_("***Starship buffeted by nova."));
662 if (game.shield >= 2000.0) game.shield -= 2000.0;
664 double diff = 2000.0 - game.shield;
668 prout(_("***Shields knocked out."));
669 game.damage[DSHIELD] += 0.005*game.damfac*Rand()*diff;
672 else game.energy -= 2000.0;
673 if (game.energy <= 0) {
677 /* add in course nova contributes to kicking starship*/
678 icx += game.sector.x-hits[mm][1];
679 icy += game.sector.y-hits[mm][2];
682 case IHK: /* kill klingon */
683 deadkl(scratch,iquad, scratch.x, scratch.y);
685 case IHC: /* Damage/destroy big enemies */
688 for_local_enemies(ll)
689 if (game.ks[ll].x==scratch.x && game.ks[ll].y==scratch.y) break;
690 game.kpower[ll] -= 800.0; /* If firepower is lost, die */
691 if (game.kpower[ll] <= 0.0) {
692 deadkl(scratch, iquad, scratch.x, scratch.y);
695 newc.x = scratch.x + scratch.x - hits[mm][1];
696 newc.y = scratch.y + scratch.y - hits[mm][2];
697 crmena(1, iquad, 2, scratch);
698 proutn(_(" damaged"));
699 if (!VALID_SECTOR(newc.x, newc.y)) {
700 /* can't leave quadrant */
704 iquad1 = game.quad[newc.x][newc.y];
705 if (iquad1 == IHBLANK) {
706 proutn(_(", blasted into "));
707 crmena(0, IHBLANK, 2, newc);
709 deadkl(scratch, iquad, newc.x, newc.y);
712 if (iquad1 != IHDOT) {
713 /* can't move into something else */
717 proutn(_(", buffeted to "));
718 proutn(cramlc(sector, newc));
719 game.quad[scratch.x][scratch.y] = IHDOT;
720 game.quad[newc.x][newc.y] = iquad;
721 game.ks[ll].x = newc.x;
722 game.ks[ll].y = newc.y;
723 game.kavgd[ll] = sqrt(square(game.sector.x-newc.x)+square(game.sector.y-newc.y));
724 game.kdist[ll] = game.kavgd[ll];
737 /* Starship affected by nova -- kick it away. */
738 game.dist = kount*0.1;
739 if (icx) icx = (icx < 0 ? -1 : 1);
740 if (icy) icy = (icy < 0 ? -1 : 1);
741 game.direc = course[3*(icx+1)+icy+2];
742 if (game.direc == 0.0) game.dist = 0.0;
743 if (game.dist == 0.0) return;
744 game.optime = 10.0*game.dist/16.0;
746 prout(_("Force of nova displaces starship."));
747 game.iattak=2; /* Eliminates recursion problem */
749 game.optime = 10.0*game.dist/16.0;
754 void snova(int insx, int insy)
756 int comdead, nsx, nsy, num=0, kldead, iscdead;
767 /* NOVAMAX being used */
771 /* Scheduled supernova -- select star */
772 /* logic changed here so that we won't favor quadrants in top
774 for_quadrants(nq.x) {
775 for_quadrants(nq.y) {
776 stars += game.state.galaxy[nq.x][nq.y].stars;
779 if (stars == 0) return; /* nothing to supernova exists */
780 num = Rand()*stars + 1;
781 for_quadrants(nq.x) {
782 for_quadrants(nq.y) {
783 num -= game.state.galaxy[nq.x][nq.y].stars;
789 proutn("=== Super nova here?");
791 nq.x = game.quadrant.x;
792 nq.y = game.quadrant.y;
797 if (nq.x != game.quadrant.y || nq.y != game.quadrant.y || game.justin != 0) {
798 /* it isn't here, or we just entered (treat as inroute) */
799 if (game.damage[DRADIO] == 0.0 || game.condit == IHDOCKED) {
801 prout(_("Message from Starfleet Command Stardate %.2f"), game.state.date);
802 prout(_(" Supernova in %s; caution advised."),
803 cramlc(quadrant, nq));
807 /* we are in the quadrant! */
809 num = Rand()* game.state.galaxy[nq.x][nq.y].stars + 1;
812 if (game.quad[nsx][nsy]==IHSTAR) {
828 prouts(_("***RED ALERT! RED ALERT!"));
830 nd.x = nsx; nd.y = nsy;
831 prout(_("***Incipient supernova detected at "), cramlc(sector, nd));
833 if (square(nsx-game.sector.x) + square(nsy-game.sector.y) <= 2.1) {
834 proutn(_("Emergency override attempts t"));
835 prouts("***************");
841 /* destroy any Klingons in supernovaed quadrant */
842 kldead = game.state.galaxy[nq.x][nq.y].klingons;
843 game.state.galaxy[nq.x][nq.y].klingons = 0;
844 comdead = iscdead = 0;
845 if (same(nq, game.state.kscmdr)) {
846 /* did in the Supercommander! */
847 game.state.nscrem = game.state.kscmdr.x = game.state.kscmdr.y = game.isatb = game.iscate = 0;
852 if (game.state.remcom) {
853 int maxloop = game.state.remcom, l;
854 for (l = 1; l <= maxloop; l++) {
855 if (same(game.state.kcmdr[l], nq)) {
856 game.state.kcmdr[l] = game.state.kcmdr[game.state.remcom];
857 game.state.kcmdr[game.state.remcom].x = game.state.kcmdr[game.state.remcom].y = 0;
861 if (game.state.remcom==0) unschedule(FTBEAM);
866 game.state.remkl -= kldead;
867 /* destroy Romulans and planets in supernovaed quadrant */
868 nrmdead = game.state.galaxy[nq.x][nq.y].romulans;
869 game.state.galaxy[nq.x][nq.y].romulans = 0;
870 game.state.nromrem -= nrmdead;
871 npdead = num - nrmdead*10;
874 for (l = 0; l < game.inplan; l++)
875 if (same(game.state.plnets[l].w, nq)) {
876 DESTROY(&game.state.plnets[l]);
879 /* Destroy any base in supernovaed quadrant */
880 if (game.state.rembase) {
881 int maxloop = game.state.rembase, l;
882 for (l = 1; l <= maxloop; l++)
883 if (same(game.state.baseq[l], nq)) {
884 game.state.baseq[l] = game.state.baseq[game.state.rembase];
885 game.state.baseq[game.state.rembase].x = game.state.baseq[game.state.rembase].y = 0;
886 game.state.rembase--;
890 /* If starship caused supernova, tally up destruction */
892 game.state.starkl += game.state.galaxy[nq.x][nq.y].stars;
893 game.state.basekl += game.state.galaxy[nq.x][nq.y].starbase;
894 game.state.nplankl += npdead;
896 /* mark supernova in galaxy and in star chart */
897 if ((game.quadrant.x == nq.x && game.quadrant.y == nq.y) ||
898 game.damage[DRADIO] == 0 ||
899 game.condit == IHDOCKED)
900 game.state.galaxy[nq.x][nq.y].supernova = true;
901 /* If supernova destroys last klingons give special message */
902 if (KLINGREM==0 && (nq.x != game.quadrant.x || nq.y != game.quadrant.y)) {
904 if (insx == 0) prout(_("Lucky you!"));
905 proutn(_("A supernova in %s has just destroyed the last Klingons."),
906 cramlc(quadrant, nq));
910 /* if some Klingons remain, continue or die in supernova */
911 if (game.alldone) finish(FSNOVAED);