]> git.pond.sub.org Git - empserver/commitdiff
Fix land unit attack mobility cost out of allied sectors
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 23 Jan 2011 18:39:48 +0000 (19:39 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 13 Feb 2011 15:03:34 +0000 (16:03 +0100)
Land units pay a mobility penalty when marching into a non-old-owned
sector without sector mobility, to slow them down in newly taken
sectors.  Attacking land units pay this penalty regardless of sector
mobility.

When attacking out of an allied sector, the penalty was computed as if
the land unit was owned by that ally.  Attacking sectors old-owned by
that ally was too cheap, and taking back one's own was too expensive.

Broken since attacking land units pay the "newly taken" mobility
penalty: commit 2e693275, v4.3.6.

src/lib/subs/attsub.c

index 4c2f7ed226e5ae8d7546c70b79ac80c1585442eb..cbb457c7326595b30a159cc8f2de6ca12c5b44ba 100644 (file)
@@ -1022,7 +1022,7 @@ ask_olist(int combat_mode, struct combat *off, struct combat *def,
             * of high-mobility sectors (mountains): for those we
             * still require attack mobility.
             */
             * of high-mobility sectors (mountains): for those we
             * still require attack mobility.
             */
-           pathcost = att_mobcost(off->own, def, lnd_mobtype(&land));
+           pathcost = att_mobcost(land.lnd_own, def, lnd_mobtype(&land));
            mobcost = lnd_pathcost(&land, pathcost);
            if (pathcost < 1.0) {
                if (land.lnd_mobil <= 0) {
            mobcost = lnd_pathcost(&land, pathcost);
            if (pathcost < 1.0) {
                if (land.lnd_mobil <= 0) {
@@ -2515,7 +2515,7 @@ take_move_in_mob(int combat_mode, struct ulist *llp, struct combat *off,
     switch (combat_mode) {
     case A_ATTACK:
        mobcost = lnd_pathcost(&llp->unit.land,
     switch (combat_mode) {
     case A_ATTACK:
        mobcost = lnd_pathcost(&llp->unit.land,
-                              att_mobcost(off->own, def,
+                              att_mobcost(llp->unit.land.lnd_own, def,
                                           lnd_mobtype(&llp->unit.land)));
        break;
     case A_ASSAULT:
                                           lnd_mobtype(&llp->unit.land)));
        break;
     case A_ASSAULT: