+ 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.condit == IHDOCKED)
+ {
+ prout("Uhura- We've lost contact with starsystem %s",
+ systemname(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, &hold);
+
+ /* recompute time left */
+ game.state.remtime = game.state.remres/(game.state.remkl+4*game.state.remcom);
+ /* report the disaster if we can */
+ if (!damaged(DRADIO) || game.condit == IHDOCKED)
+ {
+ if (same(game.quadrant, w)) {
+ prout("Spock- sensors indicate the Klingons have");
+ prout("launched a warship from %s.",systemname(q->planet));
+ } else {
+ prout("Uhura- Starfleet reports increased Klingon activity");
+ if (q->planet != NOPLANET)
+ proutn("near %s", systemname(q->planet));
+ prout("in %s.\n", cramlc(quadrant, w));
+ }
+ }
+ break;