- Allow startchart updates by sr and lr scans.
Otherwise if you kill the enemies in the quadrant
and the radio is not working, the evemies are still
on a chart, etc.
- Fix bug that the message about base under attack
sticks when the base is killed by supernova.
346*K + 400*R + 500*(C+S) - 400 for expert and emeritus.
Attacker Initial energy levels (nominal):
-Klingon Romulan Commander Super-Commander
+ Klingon Romulan Commander Super-Commander
Novice 400 700 1200
Fair 425 750 1250
Good 450 800 1300 1750
{
int evcode, i=0, j, k, l;
double fintim = game.state.date + game.optime, datemin, xtime, repair, yank=0;
- bool radio_was_broken, ictbeam = false, istract = false;
+ bool ictbeam = false, istract = false;
struct quadrant *pdest, *q;
coord w, hold;
event *ev, *ev2;
+ bool fixed_dev[NDEVICES];
if (idebug) {
prout("=== EVENTS from %.2f to %.2f:", game.state.date, fintim);
}
}
- radio_was_broken = damaged(DRADIO);
-
hold.x = hold.y = 0;
for (;;) {
/* Select earliest extraneous event, evcode==0 if no events */
if (game.condition == docked)
repair /= game.docfac;
/* Don't fix Deathray here */
- for (l=0; l<NDEVICES; l++)
- if (game.damage[l] > 0.0 && l != DDRAY)
- game.damage[l] -= (game.damage[l]-repair > 0.0 ? repair : game.damage[l]);
+ for (l=0; l<NDEVICES; l++) {
+ fixed_dev[l] = false;
+ if (game.damage[l] > 0.0 && l != DDRAY) {
+ double reminder = (game.damage[l] > repair ?
+ game.damage[l] - repair : .0);
+ game.damage[l] = reminder;
+ if (!(reminder > 0))
+ fixed_dev[l] = true;
+ }
+ }
/* If radio repaired, update star chart and attack reports */
- if (radio_was_broken && !damaged(DRADIO)) {
+ if (fixed_dev[DRADIO]) {
prout(_("Lt. Uhura- \"Captain, the sub-space radio is working and"));
prout(_(" surveillance reports are coming in."));
skip(1);
attackreport(false);
game.iseenit = true;
}
- rechart();
prout(_(" The star chart is now up to date.\""));
skip(1);
}
+ if (fixed_dev[DRADIO] || fixed_dev[DLRSENS] || fixed_dev[DSRSENS])
+ rechart();
/* Cause extraneous event EVCODE to occur */
game.optime -= xtime;
switch (evcode) {
} else {
prout(_("Uhura- Starfleet reports increased Klingon activity"));
if (q->planet != NOPLANET)
- proutn(_("near %s"), systnames[q->planet]);
+ proutn(_("near %s "), systnames[q->planet]);
prout(_("in %s.\n"), cramlc(quadrant, w));
}
}
game.state.nscrem = game.state.kscmdr.x = game.state.kscmdr.y = game.isatb = 0;
game.iscate = false;
unschedule(FSCMOVE);
+ }
+ if (same(nq, game.battle)) {
unschedule(FSCDBAS);
+ unschedule(FCDBAS);
+ invalidate(game.battle);
}
if (game.state.remcom) {
int maxloop = game.state.remcom, l;
crmshp();
skip(1);
prout(_("safely out of quadrant."));
- if (!damaged(DRADIO))
- game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = true;
+ game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = true;
/* Try to use warp engines */
if (damaged(DWARPEN)) {
skip(1);
if (!VALID_QUADRANT(x, y))
proutn(" -1");
else {
- if (!damaged(DRADIO))
- game.state.galaxy[x][y].charted = true;
+ game.state.galaxy[x][y].charted = true;
game.state.chart[x][y].klingons = game.state.galaxy[x][y].klingons;
game.state.chart[x][y].starbase = game.state.galaxy[x][y].starbase;
game.state.chart[x][y].stars = game.state.galaxy[x][y].stars;
prout(_("All devices functional."));
}
-void rechart(void)
+static void rechart_quad(int x, int y)
+{
+ if (game.state.galaxy[x][y].charted) {
+ game.state.chart[x][y].klingons = game.state.galaxy[x][y].klingons;
+ game.state.chart[x][y].starbase = game.state.galaxy[x][y].starbase;
+ game.state.chart[x][y].stars = game.state.galaxy[x][y].stars;
+ }
+}
+
+static void rechart_dsradio(void)
/* update the chart in the Enterprise's computer from galaxy data */
{
int i, j;
game.lastchart = game.state.date;
for (i = 1; i <= GALSIZE; i++)
for (j = 1; j <= GALSIZE; j++)
- if (game.state.galaxy[i][j].charted) {
- game.state.chart[i][j].klingons = game.state.galaxy[i][j].klingons;
- game.state.chart[i][j].starbase = game.state.galaxy[i][j].starbase;
- game.state.chart[i][j].stars = game.state.galaxy[i][j].stars;
- }
+ rechart_quad(i, j);
+}
+
+static void rechart_lr(void)
+/* update the chart in the Enterprise's computer from galaxy data */
+{
+ int i, j;
+ for (i = game.quadrant.x-1; i <= game.quadrant.x+1; i++) {
+ for (j = game.quadrant.y-1; j <= game.quadrant.y+1; j++) {
+ if (i == game.quadrant.x && j == game.quadrant.y)
+ continue;
+ rechart_quad(i, j);
+ }
+ }
+}
+
+static void rechart_sr(void)
+/* update the chart in the Enterprise's computer from galaxy data */
+{
+ rechart_quad(game.quadrant.x, game.quadrant.y);
+}
+
+void rechart(void)
+{
+ if (!damaged(DRADIO) || game.condition == docked) {
+ if (game.lastchart < game.state.date && game.condition == docked)
+ prout(_("Spock- \"I revised the Star Chart from the "
+ "starbase's records.\""));
+ rechart_dsradio();
+ } else {
+ if (!damaged(DLRSENS))
+ rechart_lr();
+ if (!damaged(DSRSENS))
+ rechart_sr();
+ }
}
void chart(void)
int i,j;
chew();
- if (!damaged(DRADIO))
- rechart();
-
- if (game.lastchart < game.state.date && game.condition == docked) {
- prout(_("Spock- \"I revised the Star Chart from the starbase's records.\""));
- rechart();
- }
+ rechart();
prout(_(" STAR CHART FOR THE KNOWN GALAXY"));
if (game.state.date > game.lastchart)
}
else
prout(_(" Short-range scan"));
- if (goodScan && !damaged(DRADIO)) {
- game.state.chart[game.quadrant.x][game.quadrant.y].klingons = game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons;
- game.state.chart[game.quadrant.x][game.quadrant.y].starbase = game.state.galaxy[game.quadrant.x][game.quadrant.y].starbase;
- game.state.chart[game.quadrant.x][game.quadrant.y].stars = game.state.galaxy[game.quadrant.x][game.quadrant.y].stars;
+ if (goodScan) {
game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = true;
+ rechart();
}
prout(" 1 2 3 4 5 6 7 8 9 10");
if (game.condition != docked)
else:
prout(_("Uhura- Starfleet reports increased Klingon activity"))
if q.planet != None:
- proutn(_("near %s") % q.planet)
+ proutn(_("near %s ") % q.planet)
prout(_("in Quadrant %s.") % w)
def wait():