(shp_mobcost): New.

(use_ammo, eta_calc, torp, fire_torp, perform_mission, retreat_ship1)
(shp_sweep, shp_nav_one_sector, cost_ship): Use it.

(perform_mission): Fix mobility cost of torpedo: charged full sector
cost instead of half.
This commit is contained in:
Markus Armbruster 2006-05-20 19:28:29 +00:00
parent 2cd8e99f49
commit 16b9c41b39
8 changed files with 18 additions and 54 deletions

View file

@ -55,21 +55,9 @@ static void fltp_to_list(struct fltheadstr *, struct emp_qelem *);
static void
cost_ship(struct shpstr *sp, struct fltelemstr *ep, struct fltheadstr *fp)
{
double mobcost;
double mobcost = shp_mobcost(sp);
int howfar;
mobcost = 0.0;
if (sp->shp_effic > 0) {
mobcost = sp->shp_effic * sp->shp_speed * 0.01;
mobcost = 480.0 / (mobcost * (1 + (50 + sp->shp_tech) /
(double)(200 + sp->shp_tech)));
}
/* the next two lines are not necessary since shp_mobquota is unsigned
and therefore cannot be less than 0.
if (sp->shp_mobquota<0)
sp->shp_mobquota=0;
*/
howfar = 0;
if (mobcost > 0) {
howfar = (int)sp->shp_mobil - (int)sp->shp_mobquota;