Deathray is now regressed to original 5% probability in 'plain' games.
[super-star-trek.git] / planets.c
index 69ca3271c2e32ae9e4b35dd518384e8b5538b2b6..217ce1414e72a47ce740e163cd1b02d0989a8532 100644 (file)
--- a/planets.c
+++ b/planets.c
@@ -1,7 +1,5 @@
 #include "sst.h"
 
-static int height;
-
 static char *classes[] = {"M","N","O"};
 
 static int consumeTime(void) 
@@ -12,18 +10,18 @@ static int consumeTime(void)
 //  double asave;
     ididit = 1;
 #if 0
-    /* Don't wory about this */
+    /* Don't worry about this */
     if (future[FTBEAM] <= game.state.date+Time && game.state.remcom != 0 && condit != IHDOCKED) {
        /* We are about to be tractor beamed -- operation fails */
        return 1;
     }
 #endif
 //     asave = future[FSNOVA];
-//     future[FSNOVA] = 1e30; /* defer supernovas */
+//     future[FSNOVA] = FOREVER; /* defer supernovas */
     events();  /* Used to avoid if future[FSCMOVE] within time */
 //     future[FSNOVA] = asave;
     /*fails if game over, quadrant super-novas or we've moved to new quadrant*/
-    if (alldone || game.state.galaxy[quadx][quady] == SUPERNOVA_PLACE || justin != 0) return 1;
+    if (alldone || game.state.galaxy[quadx][quady].supernova || justin != 0) return 1;
     return 0;
 }
 
@@ -71,20 +69,21 @@ void orbit(void)
     }
     if (plnetx == 0 || abs(sectx-plnetx) > 1 || abs(secty-plnety) > 1) {
        crmshp();
-       prout(" not adjacient to planet.\n");
+       prout(" not adjacent to planet.");
+       skip(1);
        return;
     }
     Time = 0.02+0.03*Rand();
     prout("Helmsman Sulu-  \"Entering standard orbit, Sir.\"");
     newcnd();
     if (consumeTime()) return;
-    height = (1400.+7200.*Rand());
-    prout("Sulu-  \"Entered orbit at altitude %.2f kilometers.\"", height);
+    game.height = (1400.0+7200.0*Rand());
+    prout("Sulu-  \"Entered orbit at altitude %.2f kilometers.\"", game.height);
     inorbit = 1;
     ididit=1;
 }
 
-void sensor(int force
+void sensor(void
 {
     skip(1);
     chew();
@@ -92,11 +91,11 @@ void sensor(int force)
        prout("Short range sensors damaged.");
        return;
     }
-    if (!plnetx && ((game.state.plnets[iplnet].known == unknown || force))) {
+    if (!plnetx && (game.options & OPTION_TTY)) {
        prout("Spock- \"No planet in this quadrant, Captain.\"");
        return;
     }
-    if ((plnetx != 0)&&(game.state.plnets[iplnet].known == unknown)) {
+    if ((plnetx != 0)&& (game.state.plnets[iplnet].known == unknown)) {
        prout("Spock-  \"Sensor scan for %s-", cramlc(quadrant, quadx, quady));
        skip(1);
        prout("         Planet at %s is of class %s.", 
@@ -319,7 +318,7 @@ void shuttle(void)
        prout("  you may not fly down.\"");
        return;
     }
-    Time = 3.0e-5*height;
+    Time = 3.0e-5*game.height;
     if (Time >= 0.8*game.state.remtime) {
        prout("First Officer Spock-  \"Captain, I compute that such");
        proutn("  a maneuver would require approximately 2d%% of our",
@@ -396,7 +395,7 @@ void shuttle(void)
 
 void deathray(void) 
 {
-    double r = Rand();
+    double dprob, r = Rand();
        
     ididit = 0;
     skip(1);
@@ -431,20 +430,25 @@ void deathray(void)
     skip(1);
     prouts("WHIRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR");
     skip(1);
-    if (r > .30) {
+    dprob = .30;
+    if (game.options & OPTION_PLAIN)
+       dprob = .5;
+    if (r > dprob) {
        prouts("Sulu- \"Captain!  It's working!\"");
        skip(2);
        while (nenhere > 0)
            deadkl(game.kx[1],game.ky[1],game.quad[game.kx[1]][game.ky[1]],game.kx[1],game.ky[1]);
        prout("Ensign Chekov-  \"Congratulations, Captain!\"");
-       if (game.state.remkl == 0) finish(FWON);
-       prout("Spock-  \"Captain, I believe the `Experimental Death Ray'");
-       if (Rand() <= 0.05) {
-           prout("   is still operational.\"");
-       }
-       else {
-           prout("   has been rendered nonfunctional.\"");
-           game.damage[DDRAY] = 39.95;
+       if (KLINGREM == 0) finish(FWON);
+       if ((game.options & OPTION_PLAIN) == 0) {
+           prout("Spock-  \"Captain, I believe the `Experimental Death Ray'");
+           if (Rand() <= 0.05) {
+               prout("   is still operational.\"");
+           }
+           else {
+               prout("   has been rendered nonfunctional.\"");
+               game.damage[DDRAY] = 39.95;
+           }
        }
        return;
     }
@@ -484,8 +488,8 @@ void deathray(void)
        proutn("Spock-  \"I believe the word is");
        prouts(" *ASTONISHING*");
        prout(" Mr. Sulu.");
-       for (i=1; i<=QUADSIZE; i++)
-           for (j=1; j<=QUADSIZE; j++)
+       for_sectors(i)
+           for_sectors(j)
                if (game.quad[i][j] == IHDOT) game.quad[i][j] = IHQUEST;
        prout("  Captain, our quadrant is now infested with");
        prouts(" - - - - - -  *THINGS*.");