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

View file

@ -224,7 +224,7 @@ shp_sweep(struct emp_qelem *ship_list, int explicit, int takemob,
struct sctstr sect; struct sctstr sect;
int mines, m, max, shells; int mines, m, max, shells;
int changed = 0; int changed = 0;
int stopping = 0; int stopping = 0, first = 1;
mlp = shp_find_capable(ship_list, M_SWEEP); mlp = shp_find_capable(ship_list, M_SWEEP);
if (!mlp) { if (!mlp) {
@ -265,6 +265,11 @@ shp_sweep(struct emp_qelem *ship_list, int explicit, int takemob,
shells = mlp->unit.ship.shp_item[I_SHELL]; shells = mlp->unit.ship.shp_item[I_SHELL];
for (m = 0; mines > 0 && m < 5; m++) { for (m = 0; mines > 0 && m < 5; m++) {
if (chance(0.66)) { if (chance(0.66)) {
if (first) {
mpr(actor, "Approaching minefield at %s...\n",
xyas(sect.sct_x, sect.sct_y, actor));
first = 0;
}
mpr(actor, "Sweep...\n"); mpr(actor, "Sweep...\n");
mines--; mines--;
shells = MIN(max, shells + 1); shells = MIN(max, shells + 1);

View file

@ -569,6 +569,7 @@
Play#1 input navi 121/122/128 j Play#1 input navi 121/122/128 j
Play#1 command navigate Play#1 command navigate
Play#1 output Play#1 1 Flagship is ms minesweeper (#121) Play#1 output Play#1 1 Flagship is ms minesweeper (#121)
Play#1 output Play#1 1 Approaching minefield at 11,-3...
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 Sweep...
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...
@ -587,6 +588,7 @@
Play#1 output Play#1 1 121 ms minesweeper 11,-3 100% 5 1 0 0 0 0 0 113 40 Play#1 output Play#1 1 121 ms minesweeper 11,-3 100% 5 1 0 0 0 0 0 113 40
Play#1 output Play#1 1 122 ms minesweeper 11,-3 100% 5 3 0 0 0 0 0 113 40 Play#1 output Play#1 1 122 ms minesweeper 11,-3 100% 5 3 0 0 0 0 0 113 40
Play#1 output Play#1 1 128 ms minesweeper 11,-3 100% 5 5 0 0 0 0 0 -12 40 Play#1 output Play#1 1 128 ms minesweeper 11,-3 100% 5 5 0 0 0 0 0 -12 40
Play#1 output Play#1 1 Approaching minefield at 11,-3...
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...
Play#1 output Play#1 1 ms minesweeper (#128) is out of mobility! Play#1 output Play#1 1 ms minesweeper (#128) is out of mobility!
Play#1 output Play#1 1 ms minesweeper (#128) is out of mobility & stays in 11,-3 Play#1 output Play#1 1 ms minesweeper (#128) is out of mobility & stays in 11,-3
@ -599,10 +601,12 @@
Play#1 input navi 129 nmh Play#1 input navi 129 nmh
Play#1 command navigate Play#1 command navigate
Play#1 output Play#1 1 Flagship is ms minesweeper (#129) Play#1 output Play#1 1 Flagship is ms minesweeper (#129)
Play#1 output Play#1 1 Approaching minefield at 10,-2...
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 Sweep...
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 Sweep...
Play#1 output Play#1 1 Approaching minefield at 10,-2...
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 Sweep...
Play#1 output Play#1 1 ms minesweeper (#129) stopped at 10,-2 Play#1 output Play#1 1 ms minesweeper (#129) stopped at 10,-2
@ -615,6 +619,7 @@
Play#1 output Play#1 1 . . Play#1 output Play#1 1 . .
Play#1 output Play#1 4 <127.0:127.0: 9,-5> Play#1 output Play#1 4 <127.0:127.0: 9,-5>
Play#1 input j Play#1 input j
Play#1 output Play#1 1 Approaching minefield at 11,-5...
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 Sweep...
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...
@ -642,6 +647,7 @@
Play#1 output Play#1 1 . . Play#1 output Play#1 1 . .
Play#1 output Play#1 4 <117.8:76.0: 11,-5> Play#1 output Play#1 4 <117.8:76.0: 11,-5>
Play#1 input mmmh Play#1 input mmmh
Play#1 output Play#1 1 Approaching minefield at 11,-5...
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...
Play#1 output Play#1 1 Kawhomp! Mine detected in 11,-5! Play#1 output Play#1 1 Kawhomp! Mine detected in 11,-5!
Play#1 output Play#1 1 ms minesweeper (#130) takes 15 Play#1 output Play#1 1 ms minesweeper (#130) takes 15
@ -652,6 +658,7 @@
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...
Play#1 output Play#1 1 Kawhomp! Mine detected in 11,-5! Play#1 output Play#1 1 Kawhomp! Mine detected in 11,-5!
Play#1 output Play#1 1 ms minesweeper (#131) takes 10 Play#1 output Play#1 1 ms minesweeper (#131) takes 10
Play#1 output Play#1 1 Approaching minefield at 11,-5...
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 Sweep...
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...
@ -664,6 +671,7 @@
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 Sweep...
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...
Play#1 output Play#1 1 Approaching minefield at 11,-5...
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 Sweep...
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...
@ -1212,6 +1220,7 @@
Play#1 input march 121/128 j Play#1 input march 121/128 j
Play#1 command march Play#1 command march
Play#1 output Play#1 1 Leader is eng engineer #121 Play#1 output Play#1 1 Leader is eng engineer #121
Play#1 output Play#1 1 Approaching minefield at 9,7...
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 Sweep...
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...
@ -1220,6 +1229,7 @@
Play#1 output Play#1 1 . . Play#1 output Play#1 1 . .
Play#1 output Play#1 4 <89.7:-23.8: 9,7> Play#1 output Play#1 4 <89.7:-23.8: 9,7>
Play#1 input mi Play#1 input mi
Play#1 output Play#1 1 Approaching minefield at 9,7...
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 Sweep...
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...
@ -1238,6 +1248,7 @@
Play#1 output Play#1 1 . . Play#1 output Play#1 1 . .
Play#1 output Play#1 4 <64.9:64.9: 7,7> Play#1 output Play#1 4 <64.9:64.9: 7,7>
Play#1 input mh Play#1 input mh
Play#1 output Play#1 1 Approaching minefield at 7,7...
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 Sweep...
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...
@ -1251,6 +1262,7 @@
Play#1 output Play#1 1 m m Play#1 output Play#1 1 m m
Play#1 output Play#1 4 <127.0:127.0: 6,6> Play#1 output Play#1 4 <127.0:127.0: 6,6>
Play#1 input j Play#1 input j
Play#1 output Play#1 1 Approaching minefield at 8,6...
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 Sweep...
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...
@ -1265,6 +1277,7 @@
Play#1 output Play#1 1 m m Play#1 output Play#1 1 m m
Play#1 output Play#1 4 <104.7:86.0: 8,6> Play#1 output Play#1 4 <104.7:86.0: 8,6>
Play#1 input mmmh Play#1 input mmmh
Play#1 output Play#1 1 Approaching minefield at 8,6...
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 Sweep...
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...
@ -1273,6 +1286,7 @@
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 Sweep...
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...
Play#1 output Play#1 1 Approaching minefield at 8,6...
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 Sweep...
Play#1 output Play#1 1 Blammo! Landmines detected in 8,6! Play#1 output Play#1 1 Blammo! Landmines detected in 8,6!
@ -1281,6 +1295,7 @@
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 Sweep...
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...
Play#1 output Play#1 1 Approaching minefield at 8,6...
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 Sweep...
Play#1 output Play#1 1 Sweep... Play#1 output Play#1 1 Sweep...