(do_mob_land): Use excess mobility to fortify. Note that units
requiring fuel to gain mobility never get excess mobility. Adapted patch from from Marc Olzheim. Closes #725457.
This commit is contained in:
parent
c4ae0d89eb
commit
bf50c6e851
1 changed files with 11 additions and 3 deletions
|
@ -412,8 +412,11 @@ do_mob_land(register struct lndstr *lp, register int etus)
|
|||
|
||||
if (lp->lnd_mobil >= land_mob_max) {
|
||||
lp->lnd_mobil = land_mob_max;
|
||||
if (lp->lnd_harden >= land_mob_max) {
|
||||
lp->lnd_harden = land_mob_max;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Give damaged units a break. When at low
|
||||
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue