Better project documentation.
[super-star-trek.git] / events.c
index 0cbc88071c8060f71d49a272290b4855d76d2c0e..c3f22f5d0996b7d0b1d43384c4471e6fba3dbb6e 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 %.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