}
game.shldup = false;
prout(_("***Shields are down."));
- if (KLINGREM) {
- pause_game(true);
- dreprt();
+ if (game.state.remkl + game.state.remcom + game.state.nscrem) {
+ announce();
+ damagereport();
}
else
finish(FWON);
case IHR: /* Hit a regular enemy */
case IHK:
/* find the enemy */
- for_local_enemies(ll)
+ for (ll = 1; ll <= game.nenhere; ll++)
if (same(w, game.ks[ll]))
break;
kp = fabs(game.kpower[ll]);
case IHB: /* Hit a base */
skip(1);
prout(_("***STARBASE DESTROYED.."));
- for_starbases(ll) {
+ for (ll = 1; ll <= game.state.rembase; ll++) {
if (same(game.state.baseq[ll], game.quadrant)) {
game.state.baseq[ll]=game.state.baseq[game.state.rembase];
break;
prout(_(" destroyed."));
game.state.nplankl++;
q->planet = NOPLANET;
- DESTROY(&game.state.planets[game.iplnet]);
+ game.state.planets[game.iplnet].pclass = destroyed;
game.iplnet = 0;
invalidate(game.plnet);
game.quad[w.x][w.y] = IHDOT;
prout(_(" destroyed."));
game.state.nworldkl++;
q->planet = NOPLANET;
- DESTROY(&game.state.planets[game.iplnet]);
+ game.state.planets[game.iplnet].pclass = destroyed;
game.iplnet = 0;
invalidate(game.plnet);
game.quad[w.x][w.y] = IHDOT;
game.quad[w.x][w.y]=IHDOT;
game.quad[jw.x][jw.y]=iquad;
prout(_(" displaced by blast to %s "), cramlc(sector, jw));
- for_local_enemies(ll)
+ for (ll = 1; ll <= game.nenhere; ll++)
game.kdist[ll] = game.kavgd[ll] = distance(game.sector,game.ks[ll]);
- sortkl();
+ sortklings();
return;
}
skip(1);
if (loop2 < loop1)
continue;
ktr += 1;
- if (ktr==3) skip(1);
+ if (ktr==3)
+ skip(1);
proutn(_(" and "));
}
proutn(device[j]);
/* Tholian gewts to move before attacking */
if (game.ithere)
- movetho();
+ movetholian();
/* if you have just entered the RNZ, you'll get a warning */
if (game.neutz) { /* The one chance not to be attacked */
if (game.skill <= SKILL_FAIR)
where = sector;
- for_local_enemies(loop) {
- if (game.kpower[loop] < 0) continue; /* too weak to attack */
+ for (loop = 1; loop <= game.nenhere; loop++) {
+ if (game.kpower[loop] < 0)
+ continue; /* too weak to attack */
/* compute hit strength and diminish shield power */
r = Rand();
/* Increase chance of photon torpedos if docked or enemy energy low */
(iquad==IHS && r > 0.07) ||
(iquad==IHQUEST && r > 0.05);
if (usephasers) { /* Enemy uses phasers */
- if (game.condition == docked) continue; /* Don't waste the effort! */
+ if (game.condition == docked)
+ continue; /* Don't waste the effort! */
attempt = true; /* Attempt to attack */
dustfac = 0.8+0.05*Rand();
hit = game.kpower[loop]*pow(dustfac,game.kavgd[loop]);
r = (Rand()+Rand())*0.5 -0.5;
r += 0.002*game.kpower[loop]*r;
torpedo(course, r, jay, &hit, 1, 1);
- if (KLINGREM==0)
+ if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0)
finish(FWON); /* Klingons did themselves in! */
if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova || game.alldone)
return; /* Supernova or finished */
}
}
/* After attack, reset average distance to enemies */
- for_local_enemies(loop)
+ for (loop = 1; loop <= game.nenhere; loop++)
game.kavgd[loop] = game.kdist[loop];
- sortkl();
+ sortklings();
return;
}
switch (type) {
case IHC:
game.comhere = false;
- for_commanders (i)
+ for (i = 1; i <= game.state.remcom; i++)
if (same(game.state.kcmdr[i], game.quadrant))
break;
game.state.kcmdr[i] = game.state.kcmdr[game.state.remcom];
/* For each kind of enemy, finish message to player */
prout(_(" destroyed."));
game.quad[w.x][w.y] = IHDOT;
- if (KLINGREM==0)
+ if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0)
return;
- game.state.remtime = game.state.remres/(game.state.remkl + 4*game.state.remcom);
+ game.state.remtime = game.state.remkl + game.state.remcom > 0 ?
+ game.state.remres/(game.state.remkl + 4*game.state.remcom) : 99;
/* Remove enemy ship from arrays describing local conditions */
if (is_scheduled(FCDBAS) && same(game.battle, game.quadrant) && type==IHC)
unschedule(FCDBAS);
- for_local_enemies(i)
+ for (i = 1; i <= game.nenhere; i++)
if (same(game.ks[i], w))
break;
game.nenhere--;
if (game.alldone || game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova)
return;
}
- if (KLINGREM==0)
+ if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0)
finish(FWON);
}
irec=0;
do {
chew();
- if (!kz) for_local_enemies(i)
- irec+=fabs(game.kpower[i])/(PHASEFAC*pow(0.90,game.kdist[i]))*
- (1.01+0.05*Rand()) + 1.0;
+ if (!kz)
+ for (i = 1; i <= game.nenhere; i++)
+ irec += fabs(game.kpower[i])/(PHASEFAC*pow(0.90,game.kdist[i]))*
+ (1.01+0.05*Rand()) + 1.0;
kz=1;
proutn(_("%d units required. "), irec);
chew();
if (game.nenhere) {
extra = 0.0;
powrem = rpow;
- for_local_enemies(i) {
+ for (i = 1; i <= game.nenhere; i++) {
hits[i] = 0.0;
if (powrem <= 0)
continue;
skip(1);
if (kpow == 0) {
deadkl(w, ienm, w);
- if (KLINGREM==0)
+ if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0)
finish(FWON);
if (game.alldone)
return;