Factor out ship firing range calculation into shp_fire_range()

This commit is contained in:
Markus Armbruster 2008-03-03 20:20:39 +01:00
parent b3c5ba2f75
commit ad5f8e8904
6 changed files with 16 additions and 7 deletions

View file

@ -306,7 +306,7 @@ multifire(void)
fshipno, fship.shp_effic);
continue;
}
range = effrange(fship.shp_frnge, fship.shp_tech);
range = shp_fire_range(&fship);
range2 = roundrange(range);
pr("range is %d.00 (%.2f)\n", range2, range);
if (target == targ_sub
@ -746,7 +746,7 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
continue;
dam += dam2;
} else {
erange = effrange(ship.shp_frnge, ship.shp_tech);
erange = shp_fire_range(&ship);
if (roundrange(erange) < ni.curdist)
continue;
dam2 = shp_fire(&ship);

View file

@ -241,7 +241,7 @@ fire_dchrg(struct shpstr *sp, struct shpstr *targ, int ntargets)
{
int range, erange, dam;
erange = roundrange(effrange(sp->shp_frnge, sp->shp_tech));
erange = roundrange(shp_fire_range(sp));
range = mapdist(sp->shp_x, sp->shp_y, targ->shp_x, targ->shp_y);
if (range > erange)
return;