Next step towards structure merge.
[super-star-trek.git] / planets.c
index a816863ecb2e75b0330bd361a976c37d73d85ee6..fefa8a4a1b95e72aa99420464ff8413eddbb4335 100644 (file)
--- a/planets.c
+++ b/planets.c
@@ -11,7 +11,7 @@ static int consumeTime(void) {
        ididit = 1;\r
 #if 0\r
        /* Don't wory about this */\r
-       if (future[FTBEAM] <= d.date+Time && d.remcom != 0 && condit != IHDOCKED) {\r
+       if (future[FTBEAM] <= state.date+Time && state.remcom != 0 && condit != IHDOCKED) {\r
                /* We are about to be tractor beamed -- operation fails */\r
                return 1;\r
        }\r
@@ -21,7 +21,7 @@ static int consumeTime(void) {
        events();       /* Used to avoid if future[FSCMOVE] within time */\r
 //     future[FSNOVA] = asave;\r
        /*fails if game over, quadrant super-novas or we've moved to new quadrant*/\r
-       if (alldone || d.galaxy[quadx][quady] == 1000 || justin != 0) return 1;\r
+       if (alldone || state.galaxy[quadx][quady] == 1000 || justin != 0) return 1;\r
        return 0;\r
 }\r
 \r
@@ -32,22 +32,22 @@ void preport(void) {
        prout("Spock-  \"Planet report follows, Captain.\"");\r
        skip(1);\r
        for (i = 1; i <= inplan; i++) {\r
-               if (d.plnets[i].known\r
+               if (state.plnets[i].known\r
 #ifdef DEBUG\r
-                       || ( idebug && d.plnets[i].x !=0)\r
+                       || ( idebug && state.plnets[i].x !=0)\r
 #endif\r
                        ) {\r
                        iknow = 1;\r
 #ifdef DEBUG\r
-                       if (idebug && d.plnets[i].known==0) proutn("(Unknown) ");\r
+                       if (idebug && state.plnets[i].known==0) proutn("(Unknown) ");\r
 #endif\r
-                       cramlc(1, d.plnets[i].x, d.plnets[i].y);\r
+                       cramlc(1, state.plnets[i].x, state.plnets[i].y);\r
                        proutn("   class ");\r
-                       proutn(classes[d.plnets[i].pclass]);\r
+                       proutn(classes[state.plnets[i].pclass]);\r
                        proutn("   ");\r
-                       if (d.plnets[i].crystals == 0) proutn("no ");\r
+                       if (state.plnets[i].crystals == 0) proutn("no ");\r
                        prout("dilithium crystals present.");\r
-                       if (d.plnets[i].known==2) \r
+                       if (state.plnets[i].known==2) \r
                                prout("    Shuttle Craft Galileo on surface.");\r
                }\r
        }\r
@@ -102,14 +102,14 @@ void sensor(void) {
        proutn("         Planet at");\r
        cramlc(2, plnetx, plnety);\r
        proutn(" is of class ");\r
-       proutn(classes[d.plnets[iplnet].pclass]);\r
+       proutn(classes[state.plnets[iplnet].pclass]);\r
        prout(".");\r
-       if (d.plnets[iplnet].known==2) \r
+       if (state.plnets[iplnet].known==2) \r
                prout("         Sensors show Galileo still on surface.");\r
        proutn("         Readings indicate");\r
-       if (d.plnets[iplnet].crystals == 0) proutn(" no");\r
+       if (state.plnets[iplnet].crystals == 0) proutn(" no");\r
        prout(" dilithium crystals present.\"");\r
-       if (d.plnets[iplnet].known == 0) d.plnets[iplnet].known = 1;\r
+       if (state.plnets[iplnet].known == 0) state.plnets[iplnet].known = 1;\r
        return;\r
 }\r
 \r
@@ -118,7 +118,7 @@ void beam(void) {
        skip(1);\r
        if (damage[DTRANSP] != 0) {\r
                prout("Transporter damaged.");\r
-               if (damage[DSHUTTL]==0 && (d.plnets[iplnet].known==2 || iscraft == 1)) {\r
+               if (damage[DSHUTTL]==0 && (state.plnets[iplnet].known==2 || iscraft == 1)) {\r
                        skip(1);\r
                        prout("Spock-  \"May I suggest the shuttle craft, Sir?\" ");\r
                        if (ja() != 0) shuttle();\r
@@ -134,7 +134,7 @@ void beam(void) {
                prout("Impossible to transport through shields.");\r
                return;\r
        }\r
-       if (d.plnets[iplnet].known==0) {\r
+       if (state.plnets[iplnet].known==0) {\r
                prout("Spock-  \"Captain, we have no information on this planet");\r
                prout("  and Starfleet Regulations clearly state that in this situation");\r
                prout("  you may not go down.\"");\r
@@ -142,7 +142,7 @@ void beam(void) {
        }\r
        if (landed==1) {\r
                /* Coming from planet */\r
-               if (d.plnets[iplnet].known==2) {\r
+               if (state.plnets[iplnet].known==2) {\r
                        proutn("Spock-  \"Wouldn't you rather take the Galileo?\" ");\r
                        if (ja() != 0) {\r
                                chew();\r
@@ -159,7 +159,7 @@ void beam(void) {
        }\r
        else {\r
                /* Going to planet */\r
-               if (d.plnets[iplnet].crystals==0) {\r
+               if (state.plnets[iplnet].crystals==0) {\r
                        prout("Spock-  \"Captain, I fail to see the logic in");\r
                        prout("  exploring a planet with no dilithium crystals.");\r
                        proutn("  Are you sure this is wise?\" ");\r
@@ -188,7 +188,7 @@ void beam(void) {
        skip(2);\r
        prout("Transport complete.");\r
        landed = -landed;\r
-       if (landed==1 && d.plnets[iplnet].known==2) {\r
+       if (landed==1 && state.plnets[iplnet].known==2) {\r
                prout("The shuttle craft Galileo is here!");\r
        }\r
        if (landed!=1 && imine==1) {\r
@@ -208,7 +208,7 @@ void mine(void) {
                prout("Mining party not on planet.");\r
                return;\r
        }\r
-       if (d.plnets[iplnet].crystals == 0) {\r
+       if (state.plnets[iplnet].crystals == 0) {\r
                prout("No dilithium crystals on this planet.");\r
                return;\r
        }\r
@@ -223,7 +223,7 @@ void mine(void) {
                prout("there's no reason to mine more at this time.");\r
                return;\r
        }\r
-       Time = (0.1+0.2*Rand())*d.plnets[iplnet].pclass;\r
+       Time = (0.1+0.2*Rand())*state.plnets[iplnet].pclass;\r
        if (consumeTime()) return;\r
        prout("Mining operation complete.");\r
        imine = 1;\r
@@ -287,7 +287,7 @@ void shuttle(void) {
        ididit = 0;\r
        if(damage[DSHUTTL] != 0.0) {\r
                if (damage[DSHUTTL] == -1.0) {\r
-                       if (inorbit && d.plnets[iplnet].known == 2)\r
+                       if (inorbit && state.plnets[iplnet].known == 2)\r
                                prout("Ye Faerie Queene has no shuttle craft bay to dock it at.");\r
                        else\r
                                prout("Ye Faerie Queene had no shuttle craft.");\r
@@ -302,11 +302,11 @@ void shuttle(void) {
                prout(" not in standard orbit.");\r
                return;\r
        }\r
-       if ((d.plnets[iplnet].known != 2) && iscraft != 1) {\r
+       if ((state.plnets[iplnet].known != 2) && iscraft != 1) {\r
                prout("Shuttle craft not currently available.");\r
                return;\r
        }\r
-       if (landed==-1 && d.plnets[iplnet].known==2) {\r
+       if (landed==-1 && state.plnets[iplnet].known==2) {\r
                prout("You will have to beam down to retrieve the shuttle craft.");\r
                return;\r
        }\r
@@ -314,17 +314,17 @@ void shuttle(void) {
                prout("Shuttle craft cannot pass through shields.");\r
                return;\r
        }\r
-       if (d.plnets[iplnet].known==0) {\r
+       if (state.plnets[iplnet].known==0) {\r
                prout("Spock-  \"Captain, we have no information on this planet");\r
                prout("  and Starfleet Regulations clearly state that in this situation");\r
                prout("  you may not fly down.\"");\r
                return;\r
        }\r
        Time = 3.0e-5*height;\r
-       if (Time >= 0.8*d.remtime) {\r
+       if (Time >= 0.8*state.remtime) {\r
                prout("First Officer Spock-  \"Captain, I compute that such");\r
                prout("  a maneuver would require approximately ");\r
-               cramf(100*Time/d.remtime,0,4);\r
+               cramf(100*Time/state.remtime,0,4);\r
                prout("% of our");\r
                prout("remaining time.");\r
                prout("Are you sure this is wise?\" ");\r
@@ -351,7 +351,7 @@ void shuttle(void) {
                        iscraft = 0;\r
                        skip(1);\r
                        if (consumeTime()) return;\r
-                       d.plnets[iplnet].known=2;\r
+                       state.plnets[iplnet].known=2;\r
                        prout("Trip complete.");\r
                        return;\r
                }\r
@@ -361,7 +361,7 @@ void shuttle(void) {
                        prout("shuttle craft for the trip back to the Enterprise.");\r
                        skip(1);\r
                        prout("The short hop begins . . .");\r
-                       d.plnets[iplnet].known=1;\r
+                       state.plnets[iplnet].known=1;\r
                        icraft = 1;\r
                        skip(1);\r
                        landed = -1;\r
@@ -388,7 +388,7 @@ void shuttle(void) {
                icraft = 1;\r
                iscraft = 0;\r
                if (consumeTime()) return;\r
-               d.plnets[iplnet].known = 2;\r
+               state.plnets[iplnet].known = 2;\r
                landed = 1;\r
                icraft = 0;\r
                prout("Trip complete");\r
@@ -439,7 +439,7 @@ void deathray(void) {
                while (nenhere > 0)\r
                        deadkl(kx[1],ky[1],quad[kx[1]][ky[1]],kx[1],ky[1]);\r
                prout("Ensign Chekov-  \"Congratulations, Captain!\"");\r
-               if (d.remkl == 0) finish(FWON);\r
+               if (state.remkl == 0) finish(FWON);\r
                prout("Spock-  \"Captain, I believe the `Experimental Death Ray'");\r
                if (Rand() <= 0.05) {\r
                        prout("   is still operational.\"");\r