Fixed klingon count to avoid winning the game before all the klingons
[super-star-trek.git] / setup.c
diff --git a/setup.c b/setup.c
index fb03bde96be24a742fe96852a8b7d53b536c8560..40e610bcc87bbc25915699275a2cebe7908db54f 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -237,12 +237,12 @@ void setup(int needprompt)
     game.future[FTBEAM] = game.state.date + expran(1.5 * (intime / game.state.remcom));
     game.future[FSNAP] = game.state.date + 1.0 + Rand(); // Force an early snapshot
     game.future[FBATTAK] = game.state.date + expran(0.3*intime);
-    game.future[FCDBAS] = 1e30;
-    game.future[FSCMOVE] = game.state.nscrem ? game.state.date+0.2777 : 1e30;
-    game.future[FSCDBAS] = 1e30;
-    game.future[FDSPROB] = 1e30;
-    // Starchart is functional
-    stdamtim = 1e30;
+    game.future[FCDBAS] = FOREVER;
+    game.future[FSCMOVE] = game.state.nscrem ? game.state.date+0.2777 : FOREVER;
+    game.future[FSCDBAS] = FOREVER;
+    game.future[FDSPROB] = FOREVER;
+    // Starchart is functional but we've never seen it
+    lastchart = FOREVER;
     // Put stars in the galaxy
     instar = 0;
     for_quadrants(i)
@@ -264,13 +264,13 @@ void setup(int needprompt)
                if (distq < 6.0*(BASEMAX+1-inbase) && Rand() < 0.75) {
                    contflag = TRUE;
 #ifdef DEBUG
-                   proutn("DEBUG: Abandoning base #%d at %d-%d\n", i, ix, iy);
+                   prout("DEBUG: Abandoning base #%d at %d-%d", i, ix, iy);
 #endif
                    break;
                }
 #ifdef DEBUG
                else if (distq < 6.0 * (BASEMAX+1-inbase)) {
-                   proutn("DEBUG: saving base #%d, close to #%d\n", i, j);
+                   prout("DEBUG: saving base #%d, close to #%d", i, j);
                }
 #endif
            }
@@ -290,7 +290,9 @@ void setup(int needprompt)
        int klump = (1.0 - r*r)*klumper;
        if (klump > krem) klump = krem;
        krem -= klump;
-       do iran(GALSIZE,&ix,&iy); while (game.state.galaxy[ix][iy].supernova);
+       do iran(GALSIZE,&ix,&iy);
+       while (game.state.galaxy[ix][iy].supernova ||
+               game.state.galaxy[ix][iy].klingons + klump > 9);
        game.state.galaxy[ix][iy].klingons += klump;
     } while (krem > 0);
     // Position Klingon Commander Ships
@@ -477,11 +479,11 @@ int choose(int needprompt)
     game.state.nscrem = (skill > SKILL_FAIR ? 1 : 0);
     game.state.remtime = 7.0 * length;
     intime = game.state.remtime;
-    game.state.remkl = 2.0*intime*((skill+1 - 2*Rand())*skill*0.1+.15);
-    inkling = game.state.remkl;
+    inkling = 2.0*intime*((skill+1 - 2*Rand())*skill*0.1+.15);
     incom = skill + 0.0625*inkling*Rand();
     game.state.remcom= min(10, incom);
     incom = game.state.remcom;
+    game.state.remkl = inkling + incom + game.state.nscrem;
     game.state.remres = (inkling+4*incom)*intime;
     inresor = game.state.remres;
     if (inkling > 50) {