printfs have been banished. All outputnow goes through prout/proutn/prouts.
[super-star-trek.git] / reports.c
index 436900e5e6044716eaaa66faf14e9ef0b6de55c9..ccb13cd80a0ac465a6bc205e1f2abe1a19bb0c01 100644 (file)
--- a/reports.c
+++ b/reports.c
@@ -42,44 +42,41 @@ void report(int f) {
                case 5: s3="emeritus"; break;\r
                default: s3="skilled"; break;\r
        }\r
-       printf("\nYou %s playing a %s%s %s game.\n",\r
+       prout("");\r
+       prout("You %s playing a %s%s %s game.",\r
                   alldone? "were": "are now", s1, s2, s3);\r
        if (skill>3 && thawed && !alldone) prout("No plaque is allowed.");\r
-       if (tourn) printf("This is tournament game %d.\n", tourn);\r
-       if (f) printf("Your secret password is \"%s\"\n",game.passwd);\r
-       printf("%d of %d Klingons have been killed",\r
+       if (tourn) prout("This is tournament game %d.", tourn);\r
+       if (f) prout("Your secret password is \"%s\"",game.passwd);\r
+       proutn("%d of %d Klingons have been killed",\r
                   game.state.killk+game.state.killc+game.state.nsckill, inkling);\r
-       if (game.state.killc) printf(", including %d Commander%s.\n", game.state.killc, game.state.killc==1?"":"s");\r
+       if (game.state.killc) prout(", including %d Commander%s.", game.state.killc, game.state.killc==1?"":"s");\r
        else if (game.state.killk+game.state.nsckill > 0) prout(", but no Commanders.");\r
        else prout(".");\r
-       if (skill > 2) printf("The Super Commander has %sbeen destroyed.\n",\r
+       if (skill > 2) prout("The Super Commander has %sbeen destroyed.",\r
                                                  game.state.nscrem?"not ":"");\r
        if (game.state.rembase != inbase) {\r
                proutn("There ");\r
                if (inbase-game.state.rembase==1) proutn("has been 1 base");\r
                else {\r
-                       proutn("have been ");\r
-                       crami(inbase-game.state.rembase, 1);\r
-                       proutn(" bases");\r
+                   proutn("have been %d bases", inbase-game.state.rembase);\r
                }\r
-               proutn(" destroyed, ");\r
-               crami(game.state.rembase, 1);\r
-               prout(" remaining.");\r
+               prout(" destroyed, %d remaining.", game.state.rembase);\r
        }\r
-       else printf("There are %d bases.\n", inbase);\r
+       else prout("There are %d bases.", inbase);\r
        if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED || iseenit) {\r
                /* Don't report this if not seen and\r
                        either the radio is dead or not at base! */\r
                attakreport();\r
                iseenit = 1;\r
        }\r
-       if (casual) printf("%d casualt%s suffered so far.\n",\r
+       if (casual) prout("%d casualt%s suffered so far.",\r
                                           casual, casual==1? "y" : "ies");\r
-       if (nhelp) printf("There were %d call%s for help.\n",\r
+       if (nhelp) prout("There were %d call%s for help.",\r
                                          nhelp, nhelp==1 ? "" : "s");\r
        if (ship == IHE) {\r
                proutn("You have ");\r
-               if (nprobes) crami(nprobes,1);\r
+               if (nprobes) proutn("%d", nprobes);\r
                else proutn("no");\r
                proutn(" deep space probe");\r
                if (nprobes!=1) proutn("s");\r
@@ -104,7 +101,7 @@ void report(int f) {
                                ai *= 2.0;\r
                                i++;\r
                        }\r
-                       printf("Dilithium crystals have been used %d time%s.\n",\r
+                       prout("Dilithium crystals have been used %d time%s.",\r
                                   i, i==1? "" : "s");\r
                }\r
        }\r
@@ -132,9 +129,9 @@ void lrscan(void) {
        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
-                               printf("   -1");\r
+                               proutn("   -1");\r
                        else {\r
-                               printf("%5d", game.state.galaxy[x][y]);\r
+                               proutn("%5d", game.state.galaxy[x][y]);\r
                                game.starch[x][y] = game.damage[DRADIO] > 0 ? game.state.galaxy[x][y]+1000 :1;\r
                        }\r
                }\r
@@ -155,7 +152,7 @@ void dreprt(void) {
                                prout("                IN FLIGHT   DOCKED");\r
                                jdam = TRUE;\r
                        }\r
-                       printf("  %16s ", device[i]);\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
@@ -194,18 +191,18 @@ void chart(int nn) {
 \r
        prout("      1    2    3    4    5    6    7    8");\r
        prout("    ----------------------------------------");\r
-       if (nn==0) prout("  -");\r
+       /* if (nn==0) prout("  -"); */\r
        for (i = 1; i <= 8; i++) {\r
-               printf("%d -", i);\r
+               proutn("%d -", i);\r
                for (j = 1; j <= 8; j++) {\r
                        if (game.starch[i][j] < 0)\r
-                               printf("  .1.");\r
+                               proutn("  .1.");\r
                        else if (game.starch[i][j] == 0)\r
-                               printf("  ...");\r
+                               proutn("  ...");\r
                        else if (game.starch[i][j] > 999)\r
-                               printf("%5d", game.starch[i][j]-1000);\r
+                               proutn("%5d", game.starch[i][j]-1000);\r
                        else\r
-                               printf("%5d", game.state.galaxy[i][j]);\r
+                               proutn("%5d", game.state.galaxy[i][j]);\r
                }\r
                prout("  -");\r
        }\r
@@ -247,7 +244,7 @@ void srscan(int l) {
                        break;\r
                case 2: // REQUEST\r
                        while (scan() == IHEOL)\r
-                               printf("Information desired? ");\r
+                               proutn("Information desired? ");\r
                        chew();\r
                        for (k = 1; k <= 10; k++)\r
                                if (strncmp(citem,requests[k],min(2,strlen(citem)))==0)\r
@@ -267,18 +264,18 @@ void srscan(int l) {
        for (i = 1; i <= 10; i++) {\r
                int jj = (k!=0 ? k : i);\r
                if (leftside) {\r
-                       printf("%2d  ", i);\r
+                       proutn("%2d  ", i);\r
                        for (j = 1; j <= 10; j++) {\r
                                if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1))\r
-                                       printf("%c ",game.quad[i][j]);\r
+                                       proutn("%c ",game.quad[i][j]);\r
                                else\r
-                                       printf("- ");\r
+                                       proutn("- ");\r
                        }\r
                }\r
                if (rightside) {\r
                        switch (jj) {\r
                                case 1:\r
-                                       printf(" Stardate      %.1f", game.state.date);\r
+                                       proutn(" Stardate      %.1f", game.state.date);\r
                                        break;\r
                                case 2:\r
                                        if (condit != IHDOCKED) newcnd();\r
@@ -288,50 +285,50 @@ void srscan(int l) {
                                                case IHYELLOW: cp = "YELLOW"; break;\r
                                                case IHDOCKED: cp = "DOCKED"; break;\r
                                        }\r
-                                       printf(" Condition     %s", cp);\r
+                                       proutn(" Condition     %s", cp);\r
                                        break;\r
                                case 3:\r
-                                       printf(" Position     ");\r
+                                       proutn(" Position     ");\r
                                        cramlc(0, quadx, quady);\r
-                                       putchar(',');\r
+                                       proutn(",");\r
                                        cramlc(0, sectx, secty);\r
                                        break;\r
                                case 4:\r
-                                       printf(" Life Support  ");\r
+                                       proutn(" Life Support  ");\r
                                        if (game.damage[DLIFSUP] != 0.0) {\r
                                                if (condit == IHDOCKED)\r
-                                                       printf("DAMAGED, supported by starbase");\r
+                                                       proutn("DAMAGED, supported by starbase");\r
                                                else\r
-                                                       printf("DAMAGED, reserves=%4.2f", lsupres);\r
+                                                       proutn("DAMAGED, reserves=%4.2f", lsupres);\r
                                        }\r
                                        else\r
-                                               printf("ACTIVE");\r
+                                               proutn("ACTIVE");\r
                                        break;\r
                                case 5:\r
-                                       printf(" Warp Factor   %.1f", warpfac);\r
+                                       proutn(" Warp Factor   %.1f", warpfac);\r
                                        break;\r
                                case 6:\r
-                                       printf(" Energy        %.2f", energy);\r
+                                       proutn(" Energy        %.2f", energy);\r
                                        break;\r
                                case 7:\r
-                                       printf(" Torpedoes     %d", torps);\r
+                                       proutn(" Torpedoes     %d", torps);\r
                                        break;\r
                                case 8:\r
-                                       printf(" Shields       ");\r
+                                       proutn(" Shields       ");\r
                                        if (game.damage[DSHIELD] != 0)\r
-                                               printf("DAMAGED,");\r
+                                               proutn("DAMAGED,");\r
                                        else if (shldup)\r
-                                               printf("UP,");\r
+                                               proutn("UP,");\r
                                        else\r
-                                               printf("DOWN,");\r
-                                       printf(" %d%% %.1f units",\r
+                                               proutn("DOWN,");\r
+                                       proutn(" %d%% %.1f units",\r
                                                   (int)((100.0*shield)/inshld + 0.5), shield);\r
                                        break;\r
                                case 9:\r
-                                       printf(" Klingons Left %d", game.state.remkl);\r
+                                       proutn(" Klingons Left %d", game.state.remkl);\r
                                        break;\r
                                case 10:\r
-                                       printf(" Time Left     %.2f", game.state.remtime);\r
+                                       proutn(" Time Left     %.2f", game.state.remtime);\r
                                        break;\r
                        }\r
                                        \r