march: Fix 'm' not to leave engineer without mobility behind

When lnd_sweep() rejects an engineer for want of mobility, it removes
it from the list of units.

Can happen only when sweeping for march sub-command 'm'.  Any engineer
without mobility is dropped from the march immediately.  Broken in
Empire 2.

Fix lnd_sweep() to handle this case just like the others, and like
shp_sweep(): report and continue with the next list member.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-12-29 17:36:36 +01:00
parent 7787cae780
commit b0221b9d2f
3 changed files with 6 additions and 4 deletions

View file

@ -602,7 +602,8 @@ lnd_sweep(struct emp_qelem *land_list, int explicit, int takemob,
}
if (takemob && llp->mobil <= 0.0) {
if (explicit)
lnd_stays(actor, "is out of mobility", llp);
mpr(actor, "%s is out of mobility!\n",
prland(&llp->unit.land));
continue;
}
getsect(llp->unit.land.lnd_x, llp->unit.land.lnd_y, &sect);

View file

@ -118,7 +118,6 @@ march 120 mh
march 121/128 j
| explicit sweep of same, out of mob
mi
| BUG: 128 stays behind
| no implicit sweep in old-owned 7,7
g
| explicit sweep in same

View file

@ -1240,14 +1240,16 @@
Play#1 output Play#1 1 Sweep...
Play#1 output Play#1 1 Sweep...
Play#1 output Play#1 1 Sweep...
Play#1 output Play#1 1 eng engineer #128 is out of mobility & stays in 9,7
Play#1 output Play#1 1 eng engineer #128 is out of mobility!
Play#1 output Play#1 1 lnd# land type x,y a eff mil sh gun xl ln mu tech retr
Play#1 output Play#1 1 121 eng engineer 9,7 100% 5 3 0 0 0 77 130 42%
Play#1 output Play#1 1 128 eng engineer 9,7 100% 5 0 0 0 0 -23 130 42%
Play#1 output Play#1 1 m m
Play#1 output Play#1 1 m m m
Play#1 output Play#1 1 . .
Play#1 output Play#1 4 <77.3:77.3: 9,7>
Play#1 output Play#1 4 <77.3:-23.8: 9,7>
Play#1 input g
Play#1 output Play#1 1 eng engineer #128 is out of mobility & stays in 9,7
Play#1 output Play#1 1 m m
Play#1 output Play#1 1 m m m
Play#1 output Play#1 1 . .