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 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));