*/
forces = game.kpower[loccom]+100.0*game.nenhere+400*(nbaddys-1);
- if (game.shldup==0) forces += 1000; /* Good for enemy if shield is down! */
+ if (!game.shldup) forces += 1000; /* Good for enemy if shield is down! */
if (game.damage[DPHASER] == 0.0 || game.damage[DPHOTON] == 0.0) {
if (game.damage[DPHASER] != 0) /* phasers damaged */
forces += 300.0;
if (game.condit==IHDOCKED && (game.options & OPTION_BASE)) /* protected by base -- back off ! */
motion -= game.skill*(2.0-square(Rand()));
}
-#ifdef DEBUG
- if (game.idebug) {
- proutn("MOTION = %1.2f", motion);
- proutn(" FORCES = %1.2f", forces);
- }
-#endif
+ if (idebug)
+ proutn("=== MOTION = %1.2f, FORCES = %1.2f, ", motion, forces);
/* don't move if no motion */
if (motion==0) return;
/* Limit motion according to skill */
if (motion > 0 && nsteps > mdist) nsteps = mdist; /* don't overshoot */
if (nsteps > QUADSIZE) nsteps = QUADSIZE; /* This shouldn't be necessary */
if (nsteps < 1) nsteps = 1; /* This shouldn't be necessary */
-#ifdef DEBUG
- if (game.idebug) {
- prout("NSTEPS = %d", nsteps);
+ if (idebug) {
+ proutn("NSTEPS = %d:", nsteps);
}
-#endif
/* Compute preferred values of delta X and Y */
mx = game.sector.x - com.x;
my = game.sector.y - com.y;
next = com;
/* main move loop */
for (ll = 0; ll < nsteps; ll++) {
-#ifdef DEBUG
- if (game.idebug) {
- prout("%d", ll+1);
- }
-#endif
+ if (idebug)
+ proutn(" %d", ll+1);
/* Check if preferred position available */
lookx = next.x + mx;
looky = next.y + my;
if (success) {
next.x = lookx;
next.y = looky;
-#ifdef DEBUG
- if (game.idebug) {
- prout(cramlc(neither, next));
- }
-#endif
+ if (idebug)
+ proutn(cramlc(neither, next));
}
else break; /* done early */
+
}
+ if (idebug)
+ prout("");
/* Put commander in place within same quadrant */
game.quad[com.x][com.y] = IHDOT;
game.quad[next.x][next.y] = ienm;
coord w;
int i;
-#ifdef DEBUG
- if (game.idebug) prout("MOVCOM");
-#endif
+ if (idebug) prout("== MOVCOM");
/* Figure out which Klingon is the commander (or Supercommander)
and do move */
sortkl();
}
-static int movescom(coord iq, int flag, int *ipage)
+static bool movescom(coord iq, int flag, int *ipage)
{
int i;
for_starbases(i)
if (game.state.baseq[i].x==iq.x && game.state.baseq[i].y==iq.y) return 1;
}
- if (game.justin && !game.iscate) return 1;
+ if (game.justin && !game.iscate) return true;
/* do the move */
game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].klingons--;
game.state.kscmdr = iq;
game.state.plnets[i].crystals == 1) {
/* destroy the planet */
DESTROY(&game.state.plnets[i]);
- game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].planet = NULL;
+ game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].planet = NOPLANET;
if (game.damage[DRADIO] == 0.0 || game.condit == IHDOCKED) {
if (*ipage==0) pause_game(1);
*ipage = 1;
break;
}
}
- return 0; /* looks good! */
+ return false; /* looks good! */
}
void scom(int *ipage)
int basetbl[BASEMAX+1];
double bdist[BASEMAX+1];
int flag;
-#ifdef DEBUG
- if (game.idebug) prout("SCOM");
-#endif
+
+ if (idebug) prout("== SCOM");
/* Decide on being active or passive */
flag = ((NKILLC+NKILLK)/(game.state.date+0.01-game.indate) < 0.1*game.skill*(game.skill+1.0) ||
for_starbases(i2) {
i = basetbl[i2]; /* bug in original had it not finding nearest*/
- ibq.x = game.state.baseq[i].x;
- ibq.y = game.state.baseq[i].y;
- if ((ibq.x == game.quadrant.x && ibq.y == game.quadrant.y) ||
- (ibq.x == game.battle.x && ibq.y == game.battle.y) ||
+ ibq = game.state.baseq[i];
+ if (same(ibq, game.quadrant) || same(ibq, game.battle) ||
game.state.galaxy[ibq.x][ibq.y].supernova ||
game.state.galaxy[ibq.x][ibq.y].klingons > 8)
continue;
}
}
if (ifindit==0) return; /* Nothing suitable -- wait until next time*/
- ibq.x = game.state.baseq[iwhichb].x;
- ibq.y = game.state.baseq[iwhichb].y;
+ ibq = game.state.baseq[iwhichb];
/* decide how to move toward base */
ideltax = ibq.x - game.state.kscmdr.x;
ideltay = ibq.y - game.state.kscmdr.y;
/* attack the base */
if (flag) return; /* no, don't attack base! */
game.iseenit = 0;
- game.isatb=1;
+ game.isatb = 1;
schedule(FSCDBAS, 1.0 +2.0*Rand());
if (is_scheduled(FCDBAS))
postpone(FSCDBAS, scheduled(FCDBAS)-game.state.date);
prout(_(" reports that it is under attack from the Klingon Super-commander."));
proutn(_(" It can survive until stardate %d.\""),
(int)scheduled(FSCDBAS));
- if (game.resting==0) return;
+ if (!game.resting) return;
prout(_("Mr. Spock- \"Captain, shall we cancel the rest period?\""));
if (ja()==0) return;
- game.resting = 0;
+ game.resting = false;
game.optime = 0.0; /* actually finished */
return;
}
}
/* Check for intelligence report */
if (
-#ifdef DEBUG
- game.idebug==0 &&
-#endif
+ !idebug &&
(Rand() > 0.2 ||
(game.damage[DRADIO] > 0.0 && game.condit != IHDOCKED) ||
!game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].charted))
}
}
game.quad[game.tholian.x][game.tholian.y] = IHT;
- game.ks[game.nenhere].x=game.tholian.x;
- game.ks[game.nenhere].y=game.tholian.y;
+ game.ks[game.nenhere] = game.tholian;
/* check to see if all holes plugged */
for_sectors(i) {