From 350a392dd5ce8420a6c0f88a3e4b460a4ebeb9f7 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 28 Dec 2008 14:01:15 +0100 Subject: [PATCH] Fix land unit attack mobility cost Land units were erroneously charged the much lower raw path cost, except when attacking high-mobility terrain (mountains). Broken in commit 2673a258, v4.3.6. --- src/lib/subs/attsub.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/subs/attsub.c b/src/lib/subs/attsub.c index bec3fd8f..61548ba0 100644 --- a/src/lib/subs/attsub.c +++ b/src/lib/subs/attsub.c @@ -966,7 +966,7 @@ ask_olist(int combat_mode, struct combat *off, struct combat *def, { struct nstr_item ni; struct lndstr land; - double mobcost; + double pathcost, mobcost; struct ulist *llp; struct lchrstr *lcp; double att_val; @@ -1040,14 +1040,14 @@ ask_olist(int combat_mode, struct combat *off, struct combat *def, * of high-mobility sectors (mountains): for those we * still require attack mobility. */ - mobcost = att_mobcost(off->own, def, lnd_mobtype(&land)); - if (mobcost < 1.0) { + pathcost = att_mobcost(off->own, def, lnd_mobtype(&land)); + mobcost = lnd_pathcost(&land, pathcost); + if (pathcost < 1.0) { if (land.lnd_mobil <= 0) { pr("%s is out of mobility\n", prland(&land)); continue; } } else { - mobcost = lnd_pathcost(&land, mobcost); if (land.lnd_mobil < mobcost) { pr("%s does not have enough mobility (%d needed)\n", prland(&land), (int)ceil(mobcost));