subs: Report where exactly ships and land units sweep mines

shp_sweep() and lnd_sweep() print only a couple of "Sweep...".
Sometimes, the sector isn't obvious, e.g. when you march multiple
sectors in one go, sweeping along the way.

Print "Approaching minefield at X,Y..." right before the first sweep
in a sector.

Note that retreat.c duplicates the sweeping code.  Retreating ships
report sweeping with coordinates since commit dcd0794, v4.2.21.
Retreating land units still sweep silently.  Left for another day.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-12-29 22:45:20 +01:00
parent 482f1e91c5
commit c8ead1ec33
3 changed files with 27 additions and 2 deletions

View file

@ -607,7 +607,7 @@ lnd_sweep(struct emp_qelem *land_list, int explicit, int takemob,
struct ulist *llp;
struct sctstr sect;
int mines, m, max, sshells, lshells;
int stopping = 0;
int stopping = 0, first = 1;
llp = lnd_find_capable(land_list, L_ENGINEER);
if (!llp) {
@ -653,6 +653,11 @@ lnd_sweep(struct emp_qelem *land_list, int explicit, int takemob,
sshells = sect.sct_item[I_SHELL];
for (m = 0; mines > 0 && m < max * 2; m++) {
if (chance(0.5 * lchr[llp->unit.land.lnd_type].l_att)) {
if (first) {
mpr(actor, "Approaching minefield at %s...\n",
xyas(sect.sct_x, sect.sct_y, actor));
first = 0;
}
mpr(actor, "Sweep...\n");
mines--;
if (lshells < max)