Next step towards structure merge.
[super-star-trek.git] / finish.c
index 1d58840fa8361a76c5ffffd6614773949a238db7..c9d6aa42a906fda31e5966e5150362b8e703e11e 100644 (file)
--- a/finish.c
+++ b/finish.c
@@ -68,26 +68,26 @@ void finish(FINTYPE ifin) {
        int igotit = 0;\r
        alldone = 1;\r
        skip(3);\r
-       printf("It is stardate %.1f .\n\n", d.date);\r
+       printf("It is stardate %.1f .\n\n", state.date);\r
        switch (ifin) {\r
                case FWON: // Game has been won\r
-                       if (d.nromrem != 0)\r
+                       if (state.nromrem != 0)\r
                                printf("The remaining %d Romulans surrender to Starfleet Command.\n",\r
-                                          d.nromrem);\r
+                                          state.nromrem);\r
                        \r
                        prout("You have smashed the Klingon invasion fleet and saved");\r
                        prout("the Federation.");\r
                        gamewon=1;\r
                        if (alive) {\r
                                double badpt;\r
-                               badpt = 5.*d.starkl + casual + 10.*d.nplankl +\r
-                                               45.*nhelp+100.*d.basekl;\r
+                               badpt = 5.*state.starkl + casual + 10.*state.nplankl +\r
+                                               45.*nhelp+100.*state.basekl;\r
                                if (ship == IHF) badpt += 100.0;\r
                                else if (ship == 0) badpt += 200.0;\r
                                if (badpt < 100.0) badpt = 0.0; // Close enough!\r
-                               if (d.date-indate < 5.0 ||\r
+                               if (state.date-indate < 5.0 ||\r
                                        // killsPerDate >= RateMax\r
-                                       (d.killk+d.killc+d.nsckill)/(d.date-indate) >=\r
+                                       (state.killk+state.killc+state.nsckill)/(state.date-indate) >=\r
                                        0.1*skill*(skill+1.0) + 0.1 + 0.008*badpt) {\r
                                        skip(1);\r
                                        prout("In fact, you have done so well that Starfleet Command");\r
@@ -105,7 +105,7 @@ void finish(FINTYPE ifin) {
                                                        prout("promotes you to Commodore Emeritus.");\r
                                                        skip(1);\r
                                                        prout("Now that you think you're really good, try playing");\r
-                                                       prout("the \"Emeritus\" game. It will splatter your ego.");\r
+                                                       prout("the \"Emeritus\" frozen. It will splatter your ego.");\r
                                                        break;\r
                                                case 5:\r
                                                        skip(1);\r
@@ -150,7 +150,7 @@ void finish(FINTYPE ifin) {
                        prout("conquered.  Your starship is now Klingon property,");\r
                        prout("and you are put on trial as a war criminal.  On the");\r
                        proutn("basis of your record, you are ");\r
-                       if (d.remkl*3.0 > inkling) {\r
+                       if (state.remkl*3.0 > inkling) {\r
                                prout("aquitted.");\r
                                skip(1);\r
                                prout("LIVE LONG AND PROSPER.");\r
@@ -275,9 +275,9 @@ void finish(FINTYPE ifin) {
        if (ship==IHF) ship= 0;\r
        else if (ship == IHE) ship = IHF;\r
        alive = 0;\r
-       if (d.remkl != 0) {\r
-               double goodies = d.remres/inresor;\r
-               double baddies = (d.remkl + 2.0*d.remcom)/(inkling+2.0*incom);\r
+       if (state.remkl != 0) {\r
+               double goodies = state.remres/inresor;\r
+               double baddies = (state.remkl + 2.0*state.remcom)/(inkling+2.0*incom);\r
                if (goodies/baddies >= 1.0+0.5*Rand()) {\r
                        prout("As a result of your actions, a treaty with the Klingon");\r
                        prout("Empire has been signed. The terms of the treaty are");\r
@@ -303,54 +303,54 @@ void finish(FINTYPE ifin) {
 }\r
 \r
 void score(void) {\r
-       double timused = d.date - indate;\r
+       double timused = state.date - indate;\r
        int ithperd, iwon, klship;\r
 \r
        pause(0);\r
 \r
        iskill = skill;\r
-       if ((timused == 0 || d.remkl != 0) && timused < 5.0) timused = 5.0;\r
-       perdate = (d.killc + d.killk + d.nsckill)/timused;\r
+       if ((timused == 0 || state.remkl != 0) && timused < 5.0) timused = 5.0;\r
+       perdate = (state.killc + state.killk + state.nsckill)/timused;\r
        ithperd = 500*perdate + 0.5;\r
        iwon = 0;\r
        if (gamewon) iwon = 100*skill;\r
        if (ship == IHE) klship = 0;\r
        else if (ship == IHF) klship = 1;\r
        else klship = 2;\r
-       if (gamewon == 0) d.nromrem = 0; // None captured if no win\r
-       iscore = 10*d.killk + 50*d.killc + ithperd + iwon\r
-                        - 100*d.basekl - 100*klship - 45*nhelp -5*d.starkl - casual\r
-                        + 20*d.nromkl + 200*d.nsckill - 10*d.nplankl + d.nromrem;\r
+       if (gamewon == 0) state.nromrem = 0; // None captured if no win\r
+       iscore = 10*state.killk + 50*state.killc + ithperd + iwon\r
+                        - 100*state.basekl - 100*klship - 45*nhelp -5*state.starkl - casual\r
+                        + 20*state.nromkl + 200*state.nsckill - 10*state.nplankl + state.nromrem;\r
        if (alive == 0) iscore -= 200;\r
        skip(2);\r
        prout("Your score --");\r
-       if (d.nromkl)\r
+       if (state.nromkl)\r
                printf("%6d Romulans destroyed                 %5d\n",\r
-                          d.nromkl,20*d.nromkl);\r
-       if (d.nromrem)\r
+                          state.nromkl,20*state.nromkl);\r
+       if (state.nromrem)\r
                printf("%6d Romulans captured                  %5d\n",\r
-                          d.nromrem, d.nromrem);\r
-       if (d.killk)\r
+                          state.nromrem, state.nromrem);\r
+       if (state.killk)\r
                printf("%6d ordinary Klingons destroyed        %5d\n",\r
-                          d.killk, 10*d.killk);\r
-       if (d.killc)\r
+                          state.killk, 10*state.killk);\r
+       if (state.killc)\r
                printf("%6d Klingon commanders destroyed       %5d\n",\r
-                          d.killc, 50*d.killc);\r
-       if (d.nsckill)\r
+                          state.killc, 50*state.killc);\r
+       if (state.nsckill)\r
                printf("%6d Super-Commander destroyed          %5d\n",\r
-                          d.nsckill, 200*d.nsckill);\r
+                          state.nsckill, 200*state.nsckill);\r
        if (ithperd)\r
                printf("%6.2f Klingons per stardate              %5d\n",\r
                           perdate, ithperd);\r
-       if (d.starkl)\r
+       if (state.starkl)\r
                printf("%6d stars destroyed by your action     %5d\n",\r
-                          d.starkl, -5*d.starkl);\r
-       if (d.nplankl)\r
+                          state.starkl, -5*state.starkl);\r
+       if (state.nplankl)\r
                printf("%6d planets destroyed by your action   %5d\n",\r
-                          d.nplankl, -10*d.nplankl);\r
-       if (d.basekl)\r
+                          state.nplankl, -10*state.nplankl);\r
+       if (state.basekl)\r
                printf("%6d bases destroyed by your action     %5d\n",\r
-                          d.basekl, -100*d.basekl);\r
+                          state.basekl, -100*state.basekl);\r
        if (nhelp)\r
                printf("%6d calls for help from starbase       %5d\n",\r
                           nhelp, -45*nhelp);\r