]> git.pond.sub.org Git - empserver/commitdiff
(do_mob_land): Fix to use all excess mobility for fortification, not
authorRon Koenderink <rkoenderink@yahoo.ca>
Fri, 29 Dec 2006 19:56:00 +0000 (19:56 +0000)
committerRon Koenderink <rkoenderink@yahoo.ca>
Fri, 29 Dec 2006 19:56:00 +0000 (19:56 +0000)
just up to the land unit's current mobility.

src/lib/update/mobility.c

index 51bd4737507a0a576eaab92634461a5c7617fec2..1de65bc5ac163c1b82ccac59c26194e4b66beb98 100644 (file)
@@ -400,11 +400,16 @@ do_mob_land(struct lndstr *lp, int etus)
     if (opt_FUEL == 0) {       /* just some bits and pieces */
        value = lp->lnd_mobil + ((float)etus * land_mob_scale);
        if (value > land_mob_max) {
+           /*
+            * provide mobility to be used in lnd_fortify()
+            * without overflowing lnd_mobil
+            */
+           lp->lnd_mobil = land_mob_max;
            if (!opt_MOB_ACCESS)
                lnd_fortify(lp, value - land_mob_max);
-           value = land_mob_max;
-       }
-       lp->lnd_mobil = value;
+           lp->lnd_mobil = land_mob_max;
+       } else
+           lp->lnd_mobil = value;
 
        return;                 /* Done! */
     }
@@ -413,11 +418,16 @@ do_mob_land(struct lndstr *lp, int etus)
     if (lp->lnd_fuelu == 0) {
        value = lp->lnd_mobil + ((float)etus * land_mob_scale);
        if (value > land_mob_max) {
+           /*
+            * provide mobility to be used in lnd_fortify()
+            * without overflowing lnd_mobil
+            */
+           lp->lnd_mobil = land_mob_max;
            if (!opt_MOB_ACCESS)
                lnd_fortify(lp, value - land_mob_max);
-           value = land_mob_max;
-       }
-       lp->lnd_mobil = value;
+           lp->lnd_mobil = land_mob_max;
+       } else
+           lp->lnd_mobil = value;
 
     } else {