(pln_sel): Clarification. No functional change.

(pln_mobcost): Don't round cost computation intermediate values.

(pln_mobcost): Don't limit cost to current mobility + 32.  No
airworthy plane can possibly use more than 55 mobility in one sortie,
and mobility going that much negative is fine.
This commit is contained in:
Markus Armbruster 2006-05-21 09:08:57 +00:00
parent 9d8674f1a2
commit ebe030feba

View file

@ -411,6 +411,7 @@ pln_sel(struct nstr_item *ni, struct emp_qelem *list, struct sctstr *ap,
continue; continue;
} }
range += ap_to_target; range += ap_to_target;
range *= rangemult;
pcp = &plchr[(int)plane.pln_type]; pcp = &plchr[(int)plane.pln_type];
bad = 0; bad = 0;
bad1 = 0; bad1 = 0;
@ -463,10 +464,9 @@ pln_sel(struct nstr_item *ni, struct emp_qelem *list, struct sctstr *ap,
if (bad) if (bad)
continue; continue;
} }
range *= rangemult;
if (plane.pln_range < range) { if (plane.pln_range < range) {
pr("%s out of range (%d:%d)\n", prplane(&plane), pr("%s out of range (%d:%d)\n",
plane.pln_range, range); prplane(&plane), plane.pln_range, range);
continue; continue;
} }
if (plane.pln_ship >= 0) { if (plane.pln_ship >= 0) {
@ -1245,16 +1245,13 @@ pln_identchance(struct plnstr *pp, int hardtarget, int type)
int int
pln_mobcost(int dist, struct plnstr *pp, int flags) pln_mobcost(int dist, struct plnstr *pp, int flags)
{ {
int cost; double cost;
cost = 20.0 / (pp->pln_effic / 100.0);
if ((flags & P_F) || (flags & P_ESC)) if ((flags & P_F) || (flags & P_ESC))
cost = 10 * 100 / pp->pln_effic; cost /= 2;
else
cost = 20 * 100 / pp->pln_effic;
cost = ldround((double)cost * dist / pp->pln_range_max, 1); return ldround(cost * dist / pp->pln_range_max + 5, 1);
return MIN(32 + pp->pln_mobil, cost + 5);
} }
/* /*