X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=reports.c;h=d4b1f63c4f4c40944a7e15f89b203102ddda1e0c;hp=3f654cf9a39e3f848e9e5cb78344b71eaf249526;hb=e7c2a3097e455ce93c62a21832e5c584031468db;hpb=e536fe754b3a9be00dcaee8f6ec50ea2d8c7a184 diff --git a/reports.c b/reports.c index 3f654cf..d4b1f63 100644 --- a/reports.c +++ b/reports.c @@ -6,7 +6,7 @@ void attakreport(int curt) { if (!curt) { - if (game.future[FCDBAS] < 1e30) { + if (game.future[FCDBAS] < FOREVER) { prout("Starbase in %s is currently under Commander attack.", cramlc(quadrant, batx, baty)); prout("It can hold out until Stardate %d.", @@ -19,7 +19,7 @@ void attakreport(int curt) (int)game.future[FSCDBAS]); } } else { - if (game.future[FCDBAS] < 1e30) + if (game.future[FCDBAS] < FOREVER) proutn("Base in %i - %i attacked by C. Alive until %.1f", batx, baty, game.future[FCDBAS]); if (isatb == 1) proutn("Base in %i - %i attacked by S. Alive until %.1f", game.state.isx, game.state.isy, game.future[FSCDBAS]); @@ -89,7 +89,7 @@ void report(void) prout("."); } if ((game.damage[DRADIO] == 0.0 || condit == IHDOCKED)&& - game.future[FDSPROB] != 1e30) { + game.future[FDSPROB] != FOREVER) { if (isarmed) proutn("An armed deep space probe is in"); else @@ -132,7 +132,7 @@ void lrscan(void) for (x = quadx-1; x <= quadx+1; x++) { proutn(" "); for (y = quady-1; y <= quady+1; y++) { - if (x == 0 || x > GALSIZE || y == 0 || y > GALSIZE) + if (!VALID_QUADRANT(x, y)) proutn(" -1"); else { if (!game.damage[DRADIO]) @@ -141,9 +141,9 @@ void lrscan(void) game.state.chart[x][y].starbase = game.state.galaxy[x][y].starbase; game.state.chart[x][y].stars = game.state.galaxy[x][y].stars; if (game.state.galaxy[x][y].supernova) - proutn("***"); + proutn(" ***"); else - proutn(" %-3d", game.state.chart[x][y].klingons*100 + game.state.chart[x][y].starbase * 10 + game.state.chart[x][y].stars); + proutn(" %3d", game.state.chart[x][y].klingons*100 + game.state.chart[x][y].starbase * 10 + game.state.chart[x][y].stars); } } prout(" "); @@ -175,9 +175,9 @@ void rechart(void) /* update the chart in the Enterprise's computer from galaxy data */ { int i, j; - stdamtim = game.state.date; - for (i=1; i <= GALSIZE ; i++) - for (j=1; j <= GALSIZE; j++) + lastchart = game.state.date; + for_quadrants(i) + for_quadrants(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; @@ -190,27 +190,23 @@ void chart(int nn) int i,j; char *cp; chew(); - if (stdamtim != 1e30 && stdamtim != game.state.date && condit == IHDOCKED) { + + if (game.damage[DRADIO] == 0.0) + rechart(); + + if (lastchart < game.state.date && condit == IHDOCKED) { proutn("Spock- \"I revised the Star Chart from the starbase's records.\"\n\r"); - } - if (nn == 0) proutn(" STAR CHART FOR THE KNOWN GALAXY\n\r"); - if (stdamtim != 1e30) { - if (condit == IHDOCKED) { - /* We are docked, so restore chart from base information */ - rechart(); - } - else if (game.state.date-stdamtim) { - prout("(Last surveillance update %d stardates ago).", - (int)(game.state.date-stdamtim)); - } - } - else if (game.damage[DRADIO] == 0.0) rechart(); + } + if (nn == 0) proutn(" STAR CHART FOR THE KNOWN GALAXY\n\r"); + if (game.state.date > lastchart) + prout("(Last surveillance update %d stardates ago).", + (int)(game.state.date-lastchart)); prout(" 1 2 3 4 5 6 7 8"); - for (i = 1; i <= GALSIZE; i++) { + for_quadrants(i) { proutn("%d |", i); - for (j = 1; j <= GALSIZE; j++) { + for_quadrants(j) { char buf[4]; proutn(" "); if (game.state.galaxy[i][j].supernova) @@ -381,7 +377,7 @@ int srscan(int l) jj = (req!=0 ? req : i); if (leftside && i <= QUADSIZE) { proutn("%2d ", i); - for (j = 1; j <= QUADSIZE; j++) { + for_sectors(j) { sectscan(goodScan, i, j); } } @@ -436,8 +432,7 @@ void eta(void) else iy2=QUADSIZE; } - if (ix1 > GALSIZE || ix1 < 1 || iy1 > GALSIZE || iy1 < 1 || - ix2 > QUADSIZE || ix2 < 1 || iy2 > QUADSIZE || iy2 < 1) { + if (!VALID_QUADRANT(ix1, iy1) || !VALID_SECTOR(ix2, iy2)) { huh(); return; }