+ case FENSLV: /* starsystem is enslaved */
+ ev = unschedule(FENSLV);
+ /* see if current distress call still active */
+ q = &game.state.galaxy[ev->quadrant.x][ev->quadrant.y];
+ if (q->klingons <= 0) {
+ q->status = secure;
+ break;
+ }
+ q->status = enslaved;
+
+ /* play stork and schedule the first baby */
+ ev2 = schedule(FREPRO, expran(2.0 * game.intime));
+ ev2->quadrant = ev->quadrant;
+
+ /* report the disaster if we can */
+ if (!damaged(DRADIO) || game.condition == docked)
+ {
+ prout(_("Uhura- We've lost contact with starsystem %s"),
+ systnames[q->planet]);
+ prout(_("in %s.\n"), cramlc(quadrant, ev->quadrant));
+ }
+ break;
+ case FREPRO: /* Klingon reproduces */
+ // If we ever switch to a real event queue, we'll need to
+ // explicitly retrieve and restore the x and y.
+ ev = schedule(FREPRO, expran(1.0 * game.intime));
+ /* see if current distress call still active */
+ q = &game.state.galaxy[ev->quadrant.x][ev->quadrant.y];
+ if (q->klingons <= 0) {
+ q->status = secure;
+ break;
+ }
+ if (game.state.remkl >=MAXKLGAME)
+ break; /* full right now */
+ /* reproduce one Klingon */
+ w = ev->quadrant;
+ if (game.klhere >= MAXKLQUAD) {
+ /* this quadrant not ok, pick an adjacent one */
+ for (i = w.x - 1; i <= w.x + 1; i++)
+ {
+ for (j = w.y - 1; j <= w.y + 1; j++)
+ {
+ if (!VALID_QUADRANT(i, j))
+ continue;
+ q = &game.state.galaxy[w.x][w.y];
+ /* check for this quad ok (not full & no snova) */
+ if (q->klingons >= MAXKLQUAD || q->supernova)
+ continue;
+ goto foundit;
+ }
+ }
+ break; /* search for eligible quadrant failed */
+ foundit:
+ w.x = i;
+ w.y = j;
+ }
+
+ /* deliver the child */
+ game.state.remkl++;
+ q->klingons++;
+ if (same(game.quadrant, w))
+ newkling(++game.klhere);
+
+ /* recompute time left */
+ game.state.remtime = game.state.remkl + game.state.remcom > 0 ?
+ game.state.remres/(game.state.remkl + 4*game.state.remcom) : 99;
+ /* report the disaster if we can */
+ if (!damaged(DRADIO) || game.condition == docked)
+ {
+ if (same(game.quadrant, w)) {
+ prout(_("Spock- sensors indicate the Klingons have"));
+ prout(_("launched a warship from %s."), systnames[q->planet]);
+ } else {
+ prout(_("Uhura- Starfleet reports increased Klingon activity"));
+ if (q->planet != NOPLANET)
+ proutn(_("near %s"), systnames[q->planet]);
+ prout(_("in %s.\n"), cramlc(quadrant, w));
+ }
+ }
+ break;