From ebe030febaaeb1711d22d530825e8bad6e7e4954 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 21 May 2006 09:08:57 +0000 Subject: [PATCH] (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. --- src/lib/subs/plnsub.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/lib/subs/plnsub.c b/src/lib/subs/plnsub.c index a76403dc..e1df6152 100644 --- a/src/lib/subs/plnsub.c +++ b/src/lib/subs/plnsub.c @@ -411,6 +411,7 @@ pln_sel(struct nstr_item *ni, struct emp_qelem *list, struct sctstr *ap, continue; } range += ap_to_target; + range *= rangemult; pcp = &plchr[(int)plane.pln_type]; bad = 0; bad1 = 0; @@ -463,10 +464,9 @@ pln_sel(struct nstr_item *ni, struct emp_qelem *list, struct sctstr *ap, if (bad) continue; } - range *= rangemult; if (plane.pln_range < range) { - pr("%s out of range (%d:%d)\n", prplane(&plane), - plane.pln_range, range); + pr("%s out of range (%d:%d)\n", + prplane(&plane), plane.pln_range, range); continue; } if (plane.pln_ship >= 0) { @@ -1245,16 +1245,13 @@ pln_identchance(struct plnstr *pp, int hardtarget, int type) int 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)) - cost = 10 * 100 / pp->pln_effic; - else - cost = 20 * 100 / pp->pln_effic; + cost /= 2; - cost = ldround((double)cost * dist / pp->pln_range_max, 1); - - return MIN(32 + pp->pln_mobil, cost + 5); + return ldround(cost * dist / pp->pln_range_max + 5, 1); } /*