]> git.pond.sub.org Git - empserver/commitdiff
Make sure land units with maximum mobility can attack mountains
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 28 Dec 2008 16:28:28 +0000 (17:28 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 28 Dec 2008 17:26:45 +0000 (18:26 +0100)
Before, land units could not attack a high-mobility terrain sector at
all when the mobility cost to enter it exceeded maximum mobilty.

src/lib/subs/attsub.c

index 61548ba0a64f009a2ab23062f5df47c72df83753..fa4ed2d09a126f677234e7ecdd9eb963e35fad38 100644 (file)
@@ -967,6 +967,7 @@ ask_olist(int combat_mode, struct combat *off, struct combat *def,
     struct nstr_item ni;
     struct lndstr land;
     double pathcost, mobcost;
+    int reqmob;
     struct ulist *llp;
     struct lchrstr *lcp;
     double att_val;
@@ -1048,9 +1049,10 @@ ask_olist(int combat_mode, struct combat *off, struct combat *def,
                    continue;
                }
            } else {
-               if (land.lnd_mobil < mobcost) {
+               reqmob = MIN(land_mob_max, (int)ceil(mobcost));
+               if (land.lnd_mobil < reqmob) {
                    pr("%s does not have enough mobility (%d needed)\n",
-                      prland(&land), (int)ceil(mobcost));
+                      prland(&land), reqmob);
                    continue;
                }
            }