From: Eric S. Raymond Date: Mon, 1 Nov 2004 07:51:33 +0000 (+0000) Subject: Clean up some float formatting. X-Git-Tag: 2.0~447 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=2a0411c349010501abd2f907b8965a8ca9b4e80c;p=super-star-trek.git Clean up some float formatting. --- diff --git a/battle.c b/battle.c index 7abe93a..5a29bb8 100644 --- a/battle.c +++ b/battle.c @@ -953,7 +953,7 @@ void phasers(void) { key = scan(); } if (key != IHREAL && nenhere != 0) { - prout("Phasers locked on target. Energy available = %3.2f", ifast?energy-200.0:energy); + prout("Phasers locked on target. Energy available = %.2f", ifast?energy-200.0:energy); } do { while (key != IHREAL) { @@ -963,7 +963,7 @@ void phasers(void) { } rpow = aaitem; if (rpow >= (ifast?energy-200:energy)) { - proutn("Energy available= %3.2f", + proutn("Energy available= %.2f", ifast?energy-200:energy); skip(1); key = IHEOL; @@ -1034,7 +1034,7 @@ void phasers(void) { int ii = game.kx[k], jj = game.ky[k]; int ienm = game.quad[ii][jj]; if (msgflag) { - proutn("Energy available= %5.2f", + proutn("Energy available= %.2f", energy-.006-(ifast?200:0)); skip(1); msgflag = 0; diff --git a/events.c b/events.c index ec3902e..c3f22f5 100644 --- a/events.c +++ b/events.c @@ -634,7 +634,7 @@ void snova(int insx, int insy) { /* it isn't here, or we just entered (treat as inroute) */ if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED) { skip(1); - prout("Message from Starfleet Command Stardate %5.2f", game.state.date); + prout("Message from Starfleet Command Stardate %.2f", game.state.date); proutn(" Supernova in %s; caution advised.", cramlc(quadrant, nqx, nqy)); } diff --git a/planets.c b/planets.c index aa29825..a45879f 100644 --- a/planets.c +++ b/planets.c @@ -79,7 +79,7 @@ void orbit(void) { newcnd(); if (consumeTime()) return; height = (1400.+7200.*Rand()); - prout("Sulu- \"Entered orbit at altitude %4.2f kilometers.\"", height); + prout("Sulu- \"Entered orbit at altitude %.2f kilometers.\"", height); inorbit = 1; return; } diff --git a/reports.c b/reports.c index e847f83..858c70c 100644 --- a/reports.c +++ b/reports.c @@ -290,7 +290,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"); @@ -438,16 +438,16 @@ void eta(void) { } else proutn("Remaining"); - prout(" energy will be %5.2f.", energy-tpower); + prout(" energy will be %.2f.", energy-tpower); if (wfl) { - prout("And we will arrive at stardate %5.2f.", + prout("And we will arrive at stardate %.2f.", game.state.date+ttime); } else if (twarp==1.0) prout("Any warp speed is adequate."); else { - prout("Minimum warp needed is %5.2f,", twarp); - prout("and we will arrive at stardate %5.2f.", + prout("Minimum warp needed is %.2f,", twarp); + prout("and we will arrive at stardate %.2f.", game.state.date+ttime); } if (game.state.remtime < ttime) diff --git a/sst.c b/sst.c index 653e06b..2ef4261 100644 --- a/sst.c +++ b/sst.c @@ -677,7 +677,7 @@ void debugme(void) { case FSCMOVE: proutn("SC Move "); break; case FSCDBAS: proutn("SC Base Destroy "); break; } - proutn("%82.2f", future[i]-game.state.date); + proutn("%.2f", future[i]-game.state.date); chew(); proutn(" ?"); key = scan();