From: Eric S. Raymond Date: Mon, 1 Nov 2004 06:23:29 +0000 (+0000) Subject: More de-FORTRANizing of the output code. X-Git-Tag: 2.0~449 X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=commitdiff_plain;h=7d27c8befdb5de9a50ff4af88e764c8336bc1797 More de-FORTRANizing of the output code. --- diff --git a/ai.c b/ai.c index 37f266c..3deab68 100644 --- a/ai.c +++ b/ai.c @@ -26,9 +26,8 @@ static int tryexit(int lookx, int looky, int ienm, int loccom, int irun) { condit == IHDOCKED) { proutn("***"); cramen(ienm); - proutn(" escapes to"); - cramlc(1, iqx, iqy); - prout(" (and regains strength)."); + proutn(" escapes to %s (and regains strength).", + cramlc(quadrant, iqx, iqy)); } /* handle local matters related to escape */ game.kx[loccom] = game.kx[nenhere]; @@ -154,11 +153,8 @@ static void movebaddy(int comx, int comy, int loccom, int ienm) { } #ifdef DEBUG if (idebug) { - proutn("MOTION = "); - cramf(motion, 1, 2); - proutn(" FORCES = "); - cramf(forces, 1, 2); - skip(1); + proutn("MOTION = %1.2f", motion); + proutn(" FORCES = %1,2f", forces); } #endif /* don't move if no motion */ @@ -239,8 +235,7 @@ static void movebaddy(int comx, int comy, int loccom, int ienm) { nexty = looky; #ifdef DEBUG if (idebug) { - cramlc(0, nextx, nexty); - skip(1); + prout(cramlc(neither, nextx, nexty)); } #endif } @@ -258,9 +253,8 @@ static void movebaddy(int comx, int comy, int loccom, int ienm) { proutn("***"); cramen(ienm); if (game.kdist[loccom] < dist1) proutn(" advances to"); - else proutn(" retreats to"); - cramlc(2, nextx, nexty); - skip(1); + else proutn(" retreats to "); + prout(cramlc(sector, nextx, nexty)); } } } @@ -351,8 +345,8 @@ static int checkdest(int iqx, int iqy, int flag, int *ipage) { if (*ipage==0) pause(1); *ipage = 1; prout("Lt. Uhura- \"Captain, Starfleet Intelligence reports"); - proutn(" a planet in"); - cramlc(1, game.state.isx, game.state.isy); + proutn(" a planet in "); + proutn(cramlc(quadrant, game.state.isx, game.state.isy)); prout(" has been destroyed"); prout(" by the Super-commander.\""); } @@ -512,13 +506,12 @@ void scom(int *ipage) { iseenit = 1; if (*ipage == 0) pause(1); *ipage=1; - proutn("Lt. Uhura- \"Captain, the starbase in"); - cramlc(1, game.state.isx, game.state.isy); + proutn("Lt. Uhura- \"Captain, the starbase in "); + proutn(cramlc(quadrant, game.state.isx, game.state.isy)); skip(1); prout(" reports that it is under attack from the Klingon Super-commander."); - proutn(" It can survive until stardate "); - cramf(game.future[FSCDBAS], 0, 1); - prout(" .\""); + proutn(" It can survive until stardate %d.\"", + (int)game.future[FSCDBAS]); if (resting==0) return; prout("Mr. Spock- \"Captain, shall we cancel the rest period?\""); if (ja()==0) return; @@ -539,8 +532,8 @@ void scom(int *ipage) { if (*ipage==0) pause(1); *ipage = 1; prout("Lt. Uhura- \"Captain, Starfleet Intelligence reports"); - proutn(" the Super-commander is in"); - cramlc(1, game.state.isx, game.state. isy); + proutn(" the Super-commander is in "); + proutn(cramlc(quadrant, game.state.isx, game.state. isy)); prout(".\""); return; } diff --git a/battle.c b/battle.c index d476711..7abe93a 100644 --- a/battle.c +++ b/battle.c @@ -191,10 +191,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit) { iy = y + 0.5; if (iy < 1 || iy > 10) break; if (l==4 || l==9) skip(1); - cramf(x, 0, 1); - proutn(" - "); - cramf(y, 0, 1); - proutn(" "); + proutn("%d - %d ", (int)x, (int)y); iquad=game.quad[ix][iy]; if (iquad==IHDOT) continue; /* hit something */ @@ -385,9 +382,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit) { if (shoved) { game.quad[jx][jy]=iquad; game.quad[ix][iy]=IHDOT; - proutn(" displaced by blast to"); - cramlc(2, jx, jy); - skip(1); + prout(" displaced by blast to %s ", cramlc(sector, jx, jy)); for (ll=1; ll<=nenhere; ll++) game.kdist[ll] = game.kavgd[ll] = sqrt(square(sectx-game.kx[ll])+square(secty-game.ky[ll])); sortkl(); @@ -515,8 +510,7 @@ void attack(int k) { shields were down for some strange reason. This doesn't make any sense, so I've fixed it */ ihurt = 1; - cramf(hit, 0, 2); - proutn(" unit hit"); + proutn("%d unit hit", (int)hit); if ((game.damage[DSRSENS] > 0 && itflag) || skill <= 2) { proutn(" on the "); crmshp(); @@ -959,9 +953,7 @@ void phasers(void) { key = scan(); } if (key != IHREAL && nenhere != 0) { - proutn("Phasers locked on target. Energy available ="); - cramf(ifast?energy-200.0:energy,1,2); - skip(1); + prout("Phasers locked on target. Energy available = %3.2f", ifast?energy-200.0:energy); } do { while (key != IHREAL) { @@ -971,8 +963,8 @@ void phasers(void) { } rpow = aaitem; if (rpow >= (ifast?energy-200:energy)) { - proutn("Energy available= "); - cramf(ifast?energy-200:energy, 1,2); + proutn("Energy available= %3.2f", + ifast?energy-200:energy); skip(1); key = IHEOL; } @@ -1017,8 +1009,7 @@ void phasers(void) { prout("phaser energy."); } else { - cramf(extra, 0, 2); - prout(" expended on empty space."); + prout("%d expended on empty space.", (int)extra); } } break; @@ -1043,8 +1034,8 @@ void phasers(void) { int ii = game.kx[k], jj = game.ky[k]; int ienm = game.quad[ii][jj]; if (msgflag) { - proutn("Energy available= "); - cramf(energy-.006-(ifast?200:0), 0, 2); + proutn("Energy available= %5.2f", + energy-.006-(ifast?200:0)); skip(1); msgflag = 0; rpow = 0.0; @@ -1165,8 +1156,7 @@ void hittem(double *hits) { ii = game.kx[kk]; jj = game.ky[kk]; if (hit > 0.005) { - cramf(hit, 0, 2); - proutn(" unit hit on "); + proutn("%d unit hit on ", (int)hit); } else proutn("Very small hit on "); @@ -1182,9 +1172,8 @@ void hittem(double *hits) { else /* decide whether or not to emasculate klingon */ if (kpow > 0 && Rand() >= 0.9 && kpow <= ((0.4 + 0.4*Rand())*kpini)) { - proutn("***Mr. Spock- \"Captain, the vessel at"); - cramlc(2,ii,jj); - skip(1); + prout("***Mr. Spock- \"Captain, the vessel at ", + cramlc(sector,ii,jj)); prout(" has just lost its firepower.\""); game.kpower[kk] = -kpow; } diff --git a/events.c b/events.c index 0cbc880..ec3902e 100644 --- a/events.c +++ b/events.c @@ -152,11 +152,10 @@ void events(void) { } iran10(§x, §y); crmshp(); - proutn(" is pulled to"); - cramlc(1, quadx, quady); + proutn(" is pulled to "); + proutn(cramlc(quadrant, quadx, quady)); proutn(", "); - cramlc(2, sectx, secty); - skip(1); + prout(cramlc(sector, sectx, secty)); if (resting) { prout("(Remainder of rest/repair period cancellegame.state.)"); resting = 0; @@ -216,12 +215,11 @@ void events(void) { if (ipage==0) pause(1); ipage = 1; skip(1); - proutn("Lt. Uhura- \"Captain, the starbase in"); - cramlc(1, batx, baty); - skip(1); + proutn("Lt. Uhura- \"Captain, the starbase in "); + prout(cramlc(quadrant, batx, baty)); prout(" reports that it is under atttack and that it can"); - proutn(" hold out only until stardate "); - cramf(game.future[FCDBAS],1,1); + proutn(" hold out only until stardate %d", + (int)game.future[FCDBAS]); prout(".\""); if (resting) { skip(1); @@ -273,8 +271,8 @@ void events(void) { ipage = 1; skip(1); prout("Lt. Uhura- \"Captain, Starfleet Command reports that"); - proutn(" the starbase in"); - cramlc(1, batx, baty); + proutn(" the starbase in "); + proutn(cramlc(quadrant, batx, baty)); prout(" has been destroyed by"); if (isatb==2) prout("the Klingon Super-Commander"); else prout("a Klingon Commander"); @@ -334,7 +332,7 @@ void events(void) { ipage = 1; skip(1); proutn("Lt. Uhura- \"The deep space probe is now in "); - cramlc(1, probecx, probecy); + proutn(cramlc(quadrant, probecx, probecy)); prout(".\""); } } @@ -385,8 +383,7 @@ void wait(void) { do { if (delay <= 0) resting = 0; if (resting == 0) { - cramf(game.state.remtime, 0, 2); - prout(" stardates left."); + prout("%d stardates left.", (int)game.state.remtime); return; } temp = Time = delay; @@ -554,8 +551,8 @@ void nova(int ix, int iy) { skip(1); break; } - proutn(", buffeted to"); - cramlc(2, newcx, newcy); + proutn(", buffeted to "); + proutn(cramlc(sector, newcx, newcy)); game.quad[ii][jj] = IHDOT; game.quad[newcx][newcy] = iquad; game.kx[ll] = newcx; @@ -637,12 +634,9 @@ 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); - proutn("Message from Starfleet Command Stardate "); - cramf(game.state.date, 0, 1); - skip(1); - proutn(" Supernova in"); - cramlc(1, nqx, nqy); - prout("; caution advised."); + prout("Message from Starfleet Command Stardate %5.2f", game.state.date); + proutn(" Supernova in %s; caution advised.", + cramlc(quadrant, nqx, nqy)); } } else { @@ -668,9 +662,7 @@ void snova(int insx, int insy) { skip(1); prouts("***RED ALERT! RED ALERT!"); skip(1); - proutn("***Incipient supernova detected at"); - cramlc(2, nsx, nsy); - skip(1); + prout("***Incipient supernova detected at ", cramlc(sector, nsx, nsy)); nqx = quadx; nqy = quady; if (square(nsx-sectx) + square(nsy-secty) <= 2.1) { @@ -753,9 +745,8 @@ void snova(int insx, int insy) { if (game.state.remkl==0 && (nqx != quadx || nqy != quady)) { skip(2); if (insx == 0) prout("Lucky you!"); - proutn("A supernova in"); - cramlc(1, nqx, nqy); - prout(" has just destroyed the last Klingons."); + proutn("A supernova in %s has just destroyed the last Klingons.", + cramlc(quadrant, nqx, nqy)); finish(FWON); return; } diff --git a/moving.c b/moving.c index d1f5baf..c48ded5 100644 --- a/moving.c +++ b/moving.c @@ -98,9 +98,9 @@ void move(void) { quady = (iy+9)/10; sectx = ix - 10*(quadx-1); secty = iy - 10*(quady-1); - proutn("\nEntering"); - cramlc(1, quadx, quady); - skip(1); + prout(""); + prout("Entering %s.", + cramlc(quadrant, quadx, quady)); game.quad[sectx][secty] = ship; newqad(0); return; @@ -129,9 +129,8 @@ void move(void) { skip(1); proutn("***"); crmshp(); - proutn(" pulled into black hole at"); - cramlc(2, ix, iy); - skip(1); + proutn(" pulled into black hole at "); + prout(cramlc(sector, ix, iy)); finish(FHOLE); return; default: @@ -139,14 +138,13 @@ void move(void) { skip(1); crmshp(); if (iquad == IHWEB) - proutn(" encounters Tholian web at"); + proutn(" encounters Tholian web at "); else - proutn(" blocked by object at"); - cramlc(2, ix,iy); + proutn(" blocked by object at "); + proutn(cramlc(sector, ix,iy)); prout(";"); proutn("Emergency stop required "); - cramf(stopegy, 0, 2); - prout(" units of energy."); + prout("%2d units of energy.", (int)stopegy); energy -= stopegy; finalx = x-deltax+0.5; sectx = finalx; @@ -357,9 +355,8 @@ static void getcd(int isprobe, int akey) { if (!isprobe) { if (itemp) { if (iprompt) { - proutn("Helmsman Sulu- \"Course locked in for"); - cramlc(2, irows, icols); - prout(".\""); + proutn("Helmsman Sulu- \"Course locked in for %s.\"", + cramlc(sector, irows, icols)); } } else prout("Ensign Chekov- \"Course laid in, Captain.\""); @@ -431,8 +428,8 @@ void impuls(void) { prout("First Officer Spock- \"Captain, the impulse engines"); prout("require 20.0 units to engage, plus 100.0 units per"); if (energy > 30) { - proutn("quadrant. We can go, therefore, a maximum of "); - cramf(0.01 * (energy-20.0)-0.05, 0, 1); + proutn("quadrant. We can go, therefore, a maximum of %d", + (int)(0.01 * (energy-20.0)-0.05)); prout(" quadrants.\""); } else { @@ -519,8 +516,8 @@ void warp(int i) { if (Time >= 0.8*game.state.remtime) { skip(1); prout("First Officer Spock- \"Captain, I compute that such"); - proutn(" a trip would require approximately "); - cramf(100.0*Time/game.state.remtime, 0, 2); + proutn(" a trip would require approximately %2.0f", + 100.0*Time/game.state.remtime); prout(" percent of our"); prout(" remaining time. Are you sure this is wise?\""); if (ja() == 0) { ididit = 0; return;} @@ -631,9 +628,8 @@ void setwrp(void) { warpfac = aaitem; wfacsq=warpfac*warpfac; if (warpfac <= oldfac || warpfac <= 6.0) { - proutn("Helmsman Sulu- \"Warp factor "); - cramf(warpfac, 0, 1); - prout(", Captain.\""); + proutn("Helmsman Sulu- \"Warp factor %do, Captain.\"", + (int)warpfac); return; } if (warpfac < 8.00) { @@ -715,9 +711,7 @@ void atover(int igrab) { } warpfac = 6.0+2.0*Rand(); wfacsq = warpfac * warpfac; - proutn("Warp factor set to "); - cramf(warpfac, 1, 1); - skip(1); + prout("Warp factor set to %d", (int)warpfac); power = 0.75*energy; dist = power/(warpfac*warpfac*warpfac*(shldup+1)); distreq = 1.4142+Rand(); @@ -745,9 +739,8 @@ void timwrp() { prout("***TIME WARP ENTERED."); if (game.state.snap && Rand() < 0.5) { /* Go back in time */ - proutn("You are traveling backwards in time "); - cramf(game.state.date-game.snapsht.date, 0, 2); - prout(" stardates."); + prout("You are traveling backwards in time %d stardates.", + (int)(game.state.date-game.snapsht.date)); game.state = game.snapsht; game.state.snap = 0; if (game.state.remcom) { @@ -794,9 +787,7 @@ void timwrp() { else { /* Go forward in time */ Time = -0.5*intime*log(Rand()); - proutn("You are traveling forward in time "); - cramf(Time, 1, 2); - prout(" stardates."); + prout("You are traveling forward in time %d stardates.", (int)Time); /* cheat to make sure no tractor beams occur during time warp */ game.future[FTBEAM] += Time; game.damage[DRADIO] += Time; @@ -922,9 +913,8 @@ void help(void) { } /* dematerialize starship */ game.quad[sectx][secty]=IHDOT; - proutn("Starbase in"); - cramlc(1, quadx, quady); - proutn(" responds--"); + proutn("Starbase in %s responds--", cramlc(quadrant, quadx, quady)); + proutn(""); crmshp(); prout(" dematerializes."); /* Give starbase three chances to rematerialize starship */ diff --git a/planets.c b/planets.c index 51a1747..aa29825 100644 --- a/planets.c +++ b/planets.c @@ -42,7 +42,7 @@ void preport(void) { #ifdef DEBUG if (idebug && game.state.plnets[i].known==unknown) proutn("(Unknown) "); #endif - cramlc(1, game.state.plnets[i].x, game.state.plnets[i].y); + proutn(cramlc(quadrant, game.state.plnets[i].x, game.state.plnets[i].y)); proutn(" class "); proutn(classes[game.state.plnets[i].pclass]); proutn(" "); @@ -78,9 +78,8 @@ void orbit(void) { prout("Helmsman Sulu- \"Entering standard orbit, Sir.\""); newcnd(); if (consumeTime()) return; - proutn("Sulu- \"Entered orbit at altitude "); - cramf(height = (1400.+7200.*Rand()), 0, 2); - prout(" kilometers.\""); + height = (1400.+7200.*Rand()); + prout("Sulu- \"Entered orbit at altitude %4.2f kilometers.\"", height); inorbit = 1; return; } @@ -96,15 +95,11 @@ void sensor(void) { prout("No planet in this quadrant."); return; } - proutn("Spock- \"Sensor scan for"); - cramlc(1, quadx, quady); - prout("-"); + prout("Spock- \"Sensor scan for %s-", cramlc(quadrant, quadx, quady)); skip(1); - proutn(" Planet at"); - cramlc(2, plnetx, plnety); - proutn(" is of class "); - proutn(classes[game.state.plnets[iplnet].pclass]); - prout("."); + prout(" Planet at %s is of class %s.", + cramlc(sector, plnetx, plnety), + classes[game.state.plnets[iplnet].pclass]); if (game.state.plnets[iplnet].known==shuttle_down) prout(" Sensors show Galileo still on surface."); proutn(" Readings indicate"); @@ -324,9 +319,8 @@ void shuttle(void) { Time = 3.0e-5*height; if (Time >= 0.8*game.state.remtime) { prout("First Officer Spock- \"Captain, I compute that such"); - prout(" a maneuver would require approximately "); - cramf(100*Time/game.state.remtime,0,4); - prout("% of our"); + proutn(" a maneuver would require approximately 2d%% of our", + (int)(100*Time/game.state.remtime)); prout("remaining time."); prout("Are you sure this is wise?\" "); if (ja()==0) { diff --git a/reports.c b/reports.c index ccb13cd..e847f83 100644 --- a/reports.c +++ b/reports.c @@ -5,20 +5,16 @@ void attakreport(void) { 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 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]); } } @@ -88,7 +84,7 @@ 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) { @@ -124,8 +120,7 @@ void lrscan(void) { skip(1); 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) @@ -152,11 +147,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 +176,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,10 +202,8 @@ 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)); +} } @@ -288,10 +279,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 "); @@ -447,23 +438,17 @@ void eta(void) { } else proutn("Remaining"); - proutn(" energy will be "); - cramf(energy-tpower, 1, 1); - prout("."); + prout(" energy will be %5.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 %5.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 %5.2f,", twarp); + prout("and we will arrive at stardate %5.2f.", + game.state.date+ttime); } if (game.state.remtime < ttime) prout("Unfortunately, the Federation will be destroyed by then."); diff --git a/setup.c b/setup.c index 747618c..0021882 100644 --- a/setup.c +++ b/setup.c @@ -359,17 +359,17 @@ void setup(void) { prout("An unknown number of Romulans."); if (game.state.nscrem) prout("and one (GULP) Super-Commander."); prout("%d stardates.",(int)intime); - proutn("%d starbases in ", inbase); + proutn("%d starbases in ", inbase); } for (i = 1; i <= inbase; i++) { - cramlc(0, game.state.baseqx[i], game.state.baseqy[i]); - if (i < inbase) proutn(" "); + proutn(cramlc(0, game.state.baseqx[i], game.state.baseqy[i])); + proutn(" "); } skip(2); - proutn("The Enterprise is currently in"); - cramlc(1, quadx, quady); + proutn("The Enterprise is currently in "); + proutn(cramlc(quadrant, quadx, quady)); proutn(" "); - cramlc(2, sectx, secty); + proutn(cramlc(sector, sectx, secty)); skip(2); prout("Good Luck!"); if (game.state.nscrem) proutn(" YOU'LL NEED IT."); diff --git a/sst.c b/sst.c index af932a0..653e06b 100644 --- a/sst.c +++ b/sst.c @@ -408,17 +408,20 @@ void cramen(int i) { proutn(s); } -void cramlc(int key, int x, int y) { - if (key == 1) proutn(" Quadrant"); - else if (key == 2) proutn(" Sector"); - proutn(" %d - %d", x, y); +char *cramlc(enum loctype key, int x, int y) { + static char buf[32]; + buf[0] = '\0'; + if (key == quadrant) strcpy(buf, "Quadrant "); + else if (key == sector) strcpy(buf, "Sector "); + sprintf(buf+strlen(buf), "%d-%d", x, y); + return buf; } void crmena(int i, int enemy, int key, int x, int y) { if (i == 1) proutn("***"); cramen(enemy); proutn(" at"); - cramlc(key, x, y); + proutn(cramlc(key, x, y)); } void crmshp(void) { @@ -528,12 +531,6 @@ int ja(void) { } } -void cramf(double x, int w, int d) { - char buf[64]; - sprintf(buf, "%*.*f", w, d, x); - proutn(buf); -} - double square(double i) { return i*i; } static void clearscreen(void) { @@ -680,7 +677,7 @@ void debugme(void) { case FSCMOVE: proutn("SC Move "); break; case FSCDBAS: proutn("SC Base Destroy "); break; } - cramf(future[i]-game.state.date, 8, 2); + proutn("%82.2f", future[i]-game.state.date); chew(); proutn(" ?"); key = scan(); diff --git a/sst.h b/sst.h index 255e5cc..8705b84 100644 --- a/sst.h +++ b/sst.h @@ -263,6 +263,7 @@ typedef enum {FWON, FDEPLETE, FLIFESUP, FNRG, FBATTLE, FMATERIALIZE, FPHASER, FLOST, FMINING, FDPLANET, FPNOVA, FSSC, FSTRACTOR, FDRAY, FTRIBBLE, FHOLE} FINTYPE ; +enum loctype {neither, quadrant, sector}; /* Define devices */ #define DSRSENS 1 @@ -380,7 +381,7 @@ void newqad(int); int ja(void); void cramen(int); void crmshp(void); -void cramlc(int, int, int); +char *cramlc(enum loctype, int, int); double expran(double); double Rand(void); void iran8(int *, int *); @@ -396,7 +397,6 @@ void deadkl(int, int, int, int, int); void timwrp(void); void movcom(void); void torpedo(double, double, int, int, double *); -void cramf(double, int, int); void huh(void); void pause(int); void nova(int, int);