- // Decide how many of everything
- if (choose(needprompt)) return; // frozen game
- // Prepare the Enterprise
- alldone = gamewon = 0;
- ship = IHE;
- energy = inenrg = 5000.0;
- shield = inshld = 2500.0;
- shldchg = shldup = 0;
- inlsr = 4.0;
- lsupres = 4.0;
- iran8(&quadx, &quady);
- iran10(§x, §y);
- torps = intorps = 10;
- nprobes = (int)(3.0*Rand() + 2.0); /* Give them 2-4 of these wonders */
- warpfac = 5.0;
- wfacsq = warpfac * warpfac;
- for (i=0; i <= NDEVICES; i++) game.damage[i] = 0.0;
- // Set up assorted game parameters
- batx = baty = 0;
- game.state.date = indate = 100.0*(int)(31.0*Rand()+20.0);
- game.state.killk = game.state.killc = nkinks = nhelp = resting = casual = game.state.nromkl = 0;
- isatb = iscate = imine = icrystl = icraft = game.state.nsckill = game.state.nplankl = 0;
- game.state.starkl = game.state.basekl = 0;
- iscraft = 1;
- landed = -1;
- alive = 1;
- docfac = 0.25;
- for (i = 1; i <= 8; i++)
- for (j = 1; j <= 8; j++) game.state.newstuf[i][j] = game.starch[i][j] = 0;
- // Initialize times for extraneous events
- game.future[FSNOVA] = game.state.date + expran(0.5 * intime);
- 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;
- // Put stars in the galaxy
- instar = 0;
- for (i=1; i<=8; i++)
- for (j=1; j<=8; j++) {
- int k = Rand()*9.0 + 1.0;
- instar += k;
- game.state.galaxy[i][j] = k;
- }
- // Locate star bases in galaxy
- for (i = 1; i <= inbase; i++) {
- int contflag;
- do {
- do iran8(&ix, &iy);
- while (game.state.galaxy[ix][iy] >= 10);
- contflag = FALSE;
- for (j = i-1; j > 0; j--) {
- /* Improved placement algorithm to spread out bases */
- double distq = square(ix-game.state.baseqx[j]) + square(iy-game.state.baseqy[j]);
- if (distq < 6.0*(6-inbase) && Rand() < 0.75) {
- contflag = TRUE;
+ // Decide how many of everything
+ if (choose(needprompt)) return; // frozen game
+ // Prepare the Enterprise
+ alldone = gamewon = 0;
+ ship = IHE;
+ energy = inenrg = 5000.0;
+ shield = inshld = 2500.0;
+ shldchg = shldup = 0;
+ inlsr = 4.0;
+ lsupres = 4.0;
+ iran(GALSIZE, &quadx, &quady);
+ iran(QUADSIZE, §x, §y);
+ torps = intorps = 10;
+ nprobes = (int)(3.0*Rand() + 2.0); /* Give them 2-4 of these wonders */
+ warpfac = 5.0;
+ wfacsq = warpfac * warpfac;
+ for (i=0; i <= NDEVICES; i++) game.damage[i] = 0.0;
+ // Set up assorted game parameters
+ batx = baty = 0;
+ game.state.date = indate = 100.0*(int)(31.0*Rand()+20.0);
+ game.state.killk = game.state.killc = nkinks = nhelp = resting = casual = game.state.nromkl = 0;
+ isatb = iscate = imine = icrystl = icraft = game.state.nsckill = game.state.nplankl = 0;
+ game.state.starkl = game.state.basekl = 0;
+ iscraft = 1;
+ landed = -1;
+ alive = 1;
+ docfac = 0.25;
+ for (i = 1; i <= GALSIZE; i++)
+ for (j = 1; j <= GALSIZE; j++) game.state.newstuf[i][j] = game.starch[i][j] = 0;
+ // Initialize times for extraneous events
+ game.future[FSNOVA] = game.state.date + expran(0.5 * intime);
+ 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;
+ // Put stars in the galaxy
+ instar = 0;
+ for (i=1; i<=GALSIZE; i++)
+ for (j=1; j<=GALSIZE; j++) {
+ int k = Rand()*9.0 + 1.0;
+ instar += k;
+ game.state.galaxy[i][j] = k * STAR_PLACE;
+ }
+ // Locate star bases in galaxy
+ for (i = 1; i <= inbase; i++) {
+ int contflag;
+ do {
+ do iran(GALSIZE, &ix, &iy);
+ while (BASES(game.state.galaxy[ix][iy]));
+ contflag = FALSE;
+ for (j = i-1; j > 0; j--) {
+ /* Improved placement algorithm to spread out bases */
+ double distq = square(ix-game.state.baseqx[j]) + square(iy-game.state.baseqy[j]);
+ if (distq < 6.0*(BASEMAX-inbase) && Rand() < 0.75) {
+ contflag = TRUE;