More de-FORTRANizing of the output code.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 1 Nov 2004 06:23:29 +0000 (06:23 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 1 Nov 2004 06:23:29 +0000 (06:23 +0000)
ai.c
battle.c
events.c
moving.c
planets.c
reports.c
setup.c
sst.c
sst.h

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