skip(2);
prout("-SUPER- STAR TREK");
skip(1);
-#ifndef __HISTORICAL__
+#ifdef __HISTORICAL__
prout("Latest update-21 Sept 78");
skip(1);
#endif /* __HISTORICAL__ */
for (;;) {
/* position next to base by trial and error */
game.quad[sectx][secty] = IHDOT;
- for (l = 1; l <= 10; l++) {
+ for (l = 1; l <= QUADSIZE; l++) {
sectx = 3.0*Rand() - 1.0 + basex;
secty = 3.0*Rand() - 1.0 + basey;
- if (sectx >= 1 && sectx <= 10 &&
- secty >= 1 && secty <= 10 &&
+ if (sectx >= 1 && sectx <= QUADSIZE &&
+ secty >= 1 && secty <= QUADSIZE &&
game.quad[sectx][secty] == IHDOT) break;
}
- if (l < 11) break; /* found a spot */
- sectx=5;
- secty=5;
+ if (l < QUADSIZE+1) break; /* found a spot */
+ sectx=QUADSIZE/2;
+ secty=QUADSIZE/2;
newqad(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;
+ 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));
stdamtim = 1e30;
// Put stars in the galaxy
instar = 0;
- for (i=1; i<=8; i++)
- for (j=1; j<=8; j++) {
+ 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;
int contflag;
do {
do iran8(&ix, &iy);
- while (game.state.galaxy[ix][iy] >= 10);
+ while (game.state.galaxy[ix][iy] >= BASE_PLACE);
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) {
+ if (distq < 6.0*(BASEMAX-inbase) && Rand() < 0.75) {
contflag = TRUE;
#ifdef DEBUG
proutn("DEBUG: Abandoning base #%d at %d-%d\n", i, ix, iy);
break;
}
#ifdef DEBUG
- else if (distq < 6.0 * (6-inbase)) {
+ else if (distq < 6.0 * (BASEMAX-inbase)) {
proutn("DEBUG: saving base #%d, close to #%d\n", i, j);
}
#endif
game.state.baseqx[i] = ix;
game.state.baseqy[i] = iy;
game.starch[ix][iy] = -1;
- game.state.galaxy[ix][iy] += 10;
+ game.state.galaxy[ix][iy] += BASE_PLACE;
}
// Position ordinary Klingon Battle Cruisers
krem = inkling - incom - game.state.nscrem;
krem -= klump;
klump *= 100;
do iran8(&ix, &iy);
- while (game.state.galaxy[ix][iy] + klump >= 1000);
+ while (game.state.galaxy[ix][iy] + klump >= SUPERNOVA_PLACE);
game.state.galaxy[ix][iy] += klump;
} while (krem > 0);
// Position Klingon Commander Ships
for (j = 1; j < i; j++)
if (game.state.cx[j]==ix && game.state.cy[j]==iy) break;
} while (j < i);
- game.state.galaxy[ix][iy] += 100;
+ game.state.galaxy[ix][iy] += ENEMY_PLACE;
game.state.cx[i] = ix;
game.state.cy[i] = iy;
}
// Locate Romulans
for (i = 1; i <= game.state.nromrem; i++) {
iran8(&ix, &iy);
- game.state.newstuf[ix][iy] += 10;
+ game.state.newstuf[ix][iy] += ROMULAN_PLACE;
}
// Locate the Super Commander
if (game.state.nscrem > 0) {
while (game.state.galaxy[ix][iy] >= 900);
game.state.isx = ix;
game.state.isy = iy;
- game.state.galaxy[ix][iy] += 100;
+ game.state.galaxy[ix][iy] += ENEMY_PLACE;
}
// Place thing (in tournament game, thingx == -1, don't want one!)
if (thingx != -1) {
void newcnd(void) {
condit = IHGREEN;
if (energy < 1000.0) condit = IHYELLOW;
- if (game.state.galaxy[quadx][quady] > 99 || game.state.newstuf[quadx][quady] > 9)
+ if (game.state.galaxy[quadx][quady] >= ENEMY_PLACE || game.state.newstuf[quadx][quady] > 9)
condit = IHRED;
if (!alive) condit=IHDEAD;
}
ientesc = 1;
}
// Clear quadrant
- for (i=1; i <= 10; i++)
- for (j=1; j <= 10; j++) game.quad[i][j] = IHDOT;
+ for (i=1; i <= QUADSIZE; i++)
+ for (j=1; j <= QUADSIZE; j++) game.quad[i][j] = IHDOT;
// cope with supernova
if (quadnum > 999) {
return;
}
- klhere = quadnum/100;
- irhere = newnum/10;
+ klhere = quadnum/ENEMY_PLACE;
+ irhere = newnum/ROMULAN_PLACE;
nplan = newnum%10;
nenhere = klhere + irhere;
// Position Starship
game.quad[sectx][secty] = ship;
- if (quadnum >= 100) {
+ if (quadnum >= ENEMY_PLACE) {
// Position ordinary Klingons
- quadnum -= 100*klhere;
+ quadnum -= ENEMY_PLACE*klhere;
for (i = 1; i <= klhere; i++) {
dropin(IHK, &ix, &iy);
game.kx[i] = ix;
game.kpower[i] = Rand()*400.0 + 450.0 + 50.0*skill;
}
// If quadrant needs a starbase, put it in
- if (quadnum >= 10) {
- quadnum -= 10;
+ if (quadnum >= BASE_PLACE) {
+ quadnum -= BASE_PLACE;
dropin(IHB, &basex, &basey);
}
#endif
) {
do {
- ithx = Rand() > 0.5 ? 10 : 1;
- ithy = Rand() > 0.5 ? 10 : 1;
+ ithx = Rand() > 0.5 ? QUADSIZE : 1;
+ ithy = Rand() > 0.5 ? QUADSIZE : 1;
} while (game.quad[ithx][ithy] != IHDOT);
game.quad[ithx][ithy] = IHT;
ithere = 1;
game.kpower[nenhere] = Rand()*400.0 +100.0 +25.0*skill;
/* Reserve unocupied corners */
if (game.quad[1][1]==IHDOT) game.quad[1][1] = 'X';
- if (game.quad[1][10]==IHDOT) game.quad[1][10] = 'X';
- if (game.quad[10][1]==IHDOT) game.quad[10][1] = 'X';
- if (game.quad[10][10]==IHDOT) game.quad[10][10] = 'X';
+ if (game.quad[1][QUADSIZE]==IHDOT) game.quad[1][QUADSIZE] = 'X';
+ if (game.quad[QUADSIZE][1]==IHDOT) game.quad[QUADSIZE][1] = 'X';
+ if (game.quad[QUADSIZE][QUADSIZE]==IHDOT) game.quad[QUADSIZE][QUADSIZE] = 'X';
}
sortkl();
// Take out X's in corners if Tholian present
if (ithere) {
if (game.quad[1][1]=='X') game.quad[1][1] = IHDOT;
- if (game.quad[1][10]=='X') game.quad[1][10] = IHDOT;
- if (game.quad[10][1]=='X') game.quad[10][1] = IHDOT;
- if (game.quad[10][10]=='X') game.quad[10][10] = IHDOT;
+ if (game.quad[1][QUADSIZE]=='X') game.quad[1][QUADSIZE] = IHDOT;
+ if (game.quad[QUADSIZE][1]=='X') game.quad[QUADSIZE][1] = IHDOT;
+ if (game.quad[QUADSIZE][QUADSIZE]=='X') game.quad[QUADSIZE][QUADSIZE] = IHDOT;
}
}