X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=reports.c;h=07a5196946a84c34e24e77d9419631bb9a036d29;hb=93ede5b2bb8928b8aa17e750f48e6c5e59b81ab1;hp=ccb13cd80a0ac465a6bc205e1f2abe1a19bb0c01;hpb=942f187b68be75931f4bd35015d74d284ef802c4;p=super-star-trek.git diff --git a/reports.c b/reports.c index ccb13cd..07a5196 100644 --- a/reports.c +++ b/reports.c @@ -3,23 +3,26 @@ #include #include -void attakreport(void) { +void attakreport(int l) { + if (!l) { if (game.future[FCDBAS] < 1e30) { - proutn("Starbase in "); - cramlc(1, batx, baty); - prout(" is currently under attack."); - proutn("It can hold out until Stardate "); - cramf(game.future[FCDBAS], 0,1); - prout("."); + prout("Starbase in %s is currently under Commander attack.", + cramlc(quadrant, batx, baty)); + prout("It can hold out until Stardate %d.", + (int)game.future[FCDBAS]); } if (isatb == 1) { - proutn("Starbase in "); - cramlc(1, game.state.isx, game.state.isy); - prout(" is under Super-commander attack."); - proutn("It can hold out until Stardate "); - cramf(game.future[FSCDBAS], 0, 1); - prout("."); + prout("Starbase in %s is under Super-commander attack.", + cramlc(quadrant, game.state.isx, game.state.isy)); + prout("It can hold out until Stardate %d.", + (int)game.future[FSCDBAS]); } + } else { + if (game.future[FCDBAS] < 1e30) + 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]); + } } @@ -67,7 +70,7 @@ void report(int f) { if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED || iseenit) { /* Don't report this if not seen and either the radio is dead or not at base! */ - attakreport(); + attakreport(0); iseenit = 1; } if (casual) prout("%d casualt%s suffered so far.", @@ -88,12 +91,12 @@ void report(int f) { proutn("An armed deep space probe is in"); else proutn("A deep space probe is in"); - cramlc(1, probecx, probecy); + proutn(cramlc(quadrant, probecx, probecy)); prout("."); } if (icrystl) { if (cryprob <= .05) - prout("Dilithium crystals aboard ship...not yet used."); + prout("Dilithium crystals aboard ship... not yet used."); else { int i=0; double ai = 0.05; @@ -122,10 +125,9 @@ void lrscan(void) { } else { skip(1); - proutn("Long-range scan for"); + proutn("Long-range scan for "); } - cramlc(1, quadx, quady); - skip(1); + prout(cramlc(quadrant, quadx, quady)); for (x = quadx-1; x <= quadx+1; x++) { for (y = quady-1; y <= quady+1; y++) { if (x == 0 || x > 8 || y == 0 || y > 8) @@ -135,7 +137,7 @@ void lrscan(void) { game.starch[x][y] = game.damage[DRADIO] > 0 ? game.state.galaxy[x][y]+1000 :1; } } - putchar('\n'); + skip(1); } } @@ -152,11 +154,10 @@ void dreprt(void) { prout(" IN FLIGHT DOCKED"); jdam = TRUE; } - proutn(" %16s ", device[i]); - cramf(game.damage[i]+0.05, 8, 2); - proutn(" "); - cramf(docfac*game.damage[i]+0.005, 8, 2); - skip(1); + prout(" %16s %8.2f %8.2f", + device[i], + game.damage[i]+0.05, + docfac*game.damage[i]+0.005); } } if (!jdam) prout("All devices functional."); @@ -182,9 +183,8 @@ void chart(int nn) { if (game.starch[i][j] == 1) game.starch[i][j] = game.state.galaxy[i][j]+1000; } else { - proutn("(Last surveillance update "); - cramf(game.state.date-stdamtim, 0, 1); - prout(" stardates ago.)"); + proutn("(Last surveillance update %d stardates ago.", + (int)(game.state.date-stdamtim)); } } if (nn ==0) skip(1); @@ -209,18 +209,16 @@ void chart(int nn) { if (nn == 0) { skip(1); crmshp(); - proutn(" is currently in"); - cramlc(1, quadx, quady); - skip(1); - } + prout(" is currently in %s", cramlc(quadrant, quadx, quady)); +} } void srscan(int l) { static char requests[][3] = {"","da","co","po","ls","wa","en","to","sh","kl","ti"}; - char *cp; - int leftside=TRUE, rightside=TRUE, i, j, jj, k=0, nn=FALSE; + char *cp = NULL; + int leftside=TRUE, rightside=TRUE, i, j, k=0, nn=FALSE; int goodScan=TRUE; switch (l) { case 1: // SRSCAN @@ -288,10 +286,10 @@ void srscan(int l) { proutn(" Condition %s", cp); break; case 3: - proutn(" Position "); - cramlc(0, quadx, quady); - proutn(","); - cramlc(0, sectx, secty); + proutn(" Position "); + proutn(cramlc(neither, quadx, quady)); + proutn(" , "); + proutn(cramlc(neither, sectx, secty)); break; case 4: proutn(" Life Support "); @@ -299,7 +297,7 @@ void srscan(int l) { if (condit == IHDOCKED) proutn("DAMAGED, supported by starbase"); else - proutn("DAMAGED, reserves=%4.2f", lsupres); + proutn("DAMAGED, reserves=%.2f", lsupres); } else proutn("ACTIVE"); @@ -328,7 +326,7 @@ void srscan(int l) { proutn(" Klingons Left %d", game.state.remkl); break; case 10: - proutn(" Time Left %.2f", game.state.remtime); + attakreport(1); break; } @@ -341,7 +339,7 @@ void srscan(int l) { void eta(void) { - int key, ix1, ix2, iy1, iy2, prompt=FALSE; + int ix1, ix2, iy1, iy2, prompt=FALSE; int wfl; double ttime, twarp, tpower; if (game.damage[DCOMPTR] != 0.0) { @@ -372,11 +370,11 @@ void eta(void) { } ix2 = aaitem + 0.5; } - else { // same quadrant - ix2 = ix1; - iy2 = iy1; - ix1 = quady; // ya got me why x and y are reversed! - iy1 = quadx; + else { + if (quady>ix1) ix2 = 1; + else ix2=10; + if (quadx>iy1) iy2 = 1; + else iy2=10; } if (ix1 > 8 || ix1 < 1 || iy1 > 8 || iy1 < 1 || @@ -447,23 +445,17 @@ void eta(void) { } else proutn("Remaining"); - proutn(" energy will be "); - cramf(energy-tpower, 1, 1); - prout("."); + prout(" energy will be %.2f.", energy-tpower); if (wfl) { - proutn("And we will arrive at stardate "); - cramf(game.state.date+ttime, 1, 1); - prout("."); + prout("And we will arrive at stardate %.2f.", + game.state.date+ttime); } else if (twarp==1.0) prout("Any warp speed is adequate."); else { - proutn("Minimum warp needed is "); - cramf(twarp, 1, 2); - skip(1); - proutn("and we will arrive at stardate "); - cramf(game.state.date+ttime, 1, 2); - prout("."); + prout("Minimum warp needed is %.2f,", twarp); + prout("and we will arrive at stardate %.2f.", + game.state.date+ttime); } if (game.state.remtime < ttime) prout("Unfortunately, the Federation will be destroyed by then.");