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.
This commit is contained in:
Markus Armbruster 2008-12-28 14:01:15 +01:00
parent dbb870fb80
commit 350a392dd5

View file

@ -966,7 +966,7 @@ ask_olist(int combat_mode, struct combat *off, struct combat *def,
{ {
struct nstr_item ni; struct nstr_item ni;
struct lndstr land; struct lndstr land;
double mobcost; double pathcost, mobcost;
struct ulist *llp; struct ulist *llp;
struct lchrstr *lcp; struct lchrstr *lcp;
double att_val; 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 * of high-mobility sectors (mountains): for those we
* still require attack mobility. * still require attack mobility.
*/ */
mobcost = att_mobcost(off->own, def, lnd_mobtype(&land)); pathcost = att_mobcost(off->own, def, lnd_mobtype(&land));
if (mobcost < 1.0) { mobcost = lnd_pathcost(&land, pathcost);
if (pathcost < 1.0) {
if (land.lnd_mobil <= 0) { if (land.lnd_mobil <= 0) {
pr("%s is out of mobility\n", prland(&land)); pr("%s is out of mobility\n", prland(&land));
continue; continue;
} }
} else { } else {
mobcost = lnd_pathcost(&land, mobcost);
if (land.lnd_mobil < mobcost) { if (land.lnd_mobil < mobcost) {
pr("%s does not have enough mobility (%d needed)\n", pr("%s does not have enough mobility (%d needed)\n",
prland(&land), (int)ceil(mobcost)); prland(&land), (int)ceil(mobcost));