return;
if (sp->sct_type == SCT_SANCT)
return;
- /* Do we have to even bother? */
- if (sp->sct_mobil >= sect_mob_max) {
- /* No, so set just in case and then return */
- sp->sct_mobil = sect_mob_max;
- return;
- }
+
value = sp->sct_mobil + ((float)etus * sect_mob_scale);
if (value > sect_mob_max)
value = sect_mob_max;
if (sp->shp_own == 0)
return;
- /* Do we even have to bother updating this mobility? */
- if (sp->shp_mobil >= ship_mob_max) {
- /* No, so don't. Just set it to max (just in case) and
- return. */
- sp->shp_mobil = ship_mob_max;
- return;
- }
-
- /* opt_FUEL in force */
if (opt_FUEL == 0 || mchr[(int)sp->shp_type].m_fuelu == 0) {
value = sp->shp_mobil + (float)etus * ship_mob_scale;
if (value > ship_mob_max)
value = ship_mob_max;
sp->shp_mobil = (signed char)value;
} else {
+ if (sp->shp_mobil >= ship_mob_max) {
+ sp->shp_mobil = ship_mob_max;
+ return;
+ }
can_add = ship_mob_max - sp->shp_mobil;
if (can_add > (float)etus * ship_mob_scale)
can_add = (float)etus * ship_mob_scale;
if (lp->lnd_own == 0)
return;
- 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;
- }
- }
-
if (opt_FUEL == 0 || lp->lnd_fuelu == 0) {
value = lp->lnd_mobil + ((float)etus * land_mob_scale);
if (value > land_mob_max) {
- if (!opt_MOB_ACCESS) {
+ if (lp->lnd_harden < land_mob_max && !opt_MOB_ACCESS) {
/*
+ * Automatic fortification on excess mobility.
+ * Disabled for MOB_ACCESS, because it leads to
+ * excessively deep recursion and thus miserable
+ * performance as the number of land units grows.
+ *
* Provide mobility to be used in lnd_fortify()
* without overflowing lnd_mobil.
*/
lp->lnd_mobil = value;
} else {
+ if (lp->lnd_mobil >= land_mob_max) {
+ lp->lnd_mobil = land_mob_max;
+ return;
+ }
can_add = land_mob_max - lp->lnd_mobil;
if (pp->pln_own == 0)
return;
- if (pp->pln_mobil >= plane_mob_max) {
- pp->pln_mobil = plane_mob_max;
- return;
- }
value = pp->pln_mobil + ((float)etus * plane_mob_scale);
if (value > plane_mob_max)