]> git.pond.sub.org Git - empserver/commitdiff
(do_mob_land): Use excess mobility to fortify. Note that units
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 28 Jan 2004 17:00:29 +0000 (17:00 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 28 Jan 2004 17:00:29 +0000 (17:00 +0000)
requiring fuel to gain mobility never get excess mobility.  Adapted
patch from from Marc Olzheim.  Closes #725457.

src/lib/update/mobility.c

index 333421a2e0fa0d7c2cb15335e38ed6eb8b0e2786..83762875396f11ea6dd4b1ace580e268e191b400 100644 (file)
@@ -412,7 +412,10 @@ do_mob_land(register struct lndstr *lp, register int etus)
 
     if (lp->lnd_mobil >= land_mob_max) {
        lp->lnd_mobil = land_mob_max;
-       return;
+       if (lp->lnd_harden >= land_mob_max) {
+           lp->lnd_harden = land_mob_max;
+           return;
+       }
     }
 
     /*
@@ -440,8 +443,10 @@ do_mob_land(register struct lndstr *lp, register int etus)
        } else {
            value = lp->lnd_mobil + ((float)etus * land_mob_scale);
        }
-       if (value > land_mob_max)
+       if (value > land_mob_max) {
+           lnd_fortify(lp, value - land_mob_max);
            value = land_mob_max;
+       }
        lp->lnd_mobil = value;
 
        return;                 /* Done! */
@@ -458,8 +463,10 @@ do_mob_land(register struct lndstr *lp, register int etus)
        } else {
            value = lp->lnd_mobil + ((float)etus * land_mob_scale);
        }
-       if (value > land_mob_max)
+       if (value > land_mob_max) {
+           lnd_fortify(lp, value - land_mob_max);
            value = land_mob_max;
+       }
        lp->lnd_mobil = value;
 
     } else {
@@ -517,6 +524,7 @@ do_mob_land(register struct lndstr *lp, register int etus)
        if (total_add + lp->lnd_mobil > land_mob_max) {
            total_add = land_mob_max - lp->lnd_mobil;
        }
+       /* no automatic fortification here, as it would cost fuel */
 
        if (opt_MOB_ACCESS) {
            if (lp->lnd_mobil < 0)