for (;;) {
/* position next to base by trial and error */
game.quad[sectx][secty] = IHDOT;
- for (l = 1; l <= QUADSIZE; l++) {
+ for_sectors(l) {
sectx = 3.0*Rand() - 1.0 + basex;
secty = 3.0*Rand() - 1.0 + basey;
- if (sectx >= 1 && sectx <= QUADSIZE &&
- secty >= 1 && secty <= QUADSIZE &&
+ if (VALID_SECTOR(sectx, secty) &&
game.quad[sectx][secty] == IHDOT) break;
}
if (l < QUADSIZE+1) break; /* found a spot */
landed = -1;
alive = 1;
docfac = 0.25;
- for (i = 1; i <= GALSIZE; i++)
- for (j = 1; j <= GALSIZE; j++) {
+ for_quadrants(i)
+ for_quadrants(j) {
game.state.galaxy[i][j].charted = 0;
game.state.galaxy[i][j].planets = 0;
game.state.galaxy[i][j].romulans = 0;
stdamtim = 1e30;
// Put stars in the galaxy
instar = 0;
- for (i=1; i<=GALSIZE; i++)
- for (j=1; j<=GALSIZE; j++) {
+ for_quadrants(i)
+ for_quadrants(j) {
int k = Rand()*9.0 + 1.0;
instar += k;
game.state.galaxy[i][j].stars = k;
ientesc = 1;
}
// Clear quadrant
- for (i=1; i <= QUADSIZE; i++)
- for (j=1; j <= QUADSIZE; j++)
+ for_sectors(i)
+ for_sectors(j)
game.quad[i][j] = IHDOT;
// cope with supernova
if (game.state.galaxy[quadx][quady].supernova)
game.kpower[i] = Rand()*150.0 +300.0 +25.0*skill;
}
// If we need a commander, promote a Klingon
- for (i = 1; i <= game.state.remcom ; i++)
+ for_commanders(i)
if (game.state.cx[i]==quadx && game.state.cy[i]==quady) break;
if (i <= game.state.remcom) {