navigate march: Stop on non-fatal mine hits, too

We stop on mine hits only when they're fatal.  Has always been that
way.  When interdiction was added in Chainsaw, it worked the same.
Empire 2 changed the commands to stop on any interdiction damage.  Now
stop on any mine damage, too.

Interdiction can fail to do damage (all bombs miss), and mines can be
detected without damage (by sweeping).  Perhaps we should stop then as
well.  Left for another day.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-01-05 20:23:46 +01:00
parent 0538f95cd6
commit c5c6fc8a66
5 changed files with 74 additions and 38 deletions

View file

@ -691,11 +691,7 @@ lnd_sweep(struct emp_qelem *land_list, int explicit, int takemob,
sect.sct_item[I_SHELL] = sshells; sect.sct_item[I_SHELL] = sshells;
putland(llp->unit.land.lnd_uid, &llp->unit.land); putland(llp->unit.land.lnd_uid, &llp->unit.land);
putsect(&sect); putsect(&sect);
if (lnd_check_one_mines(llp, 1)) { stopping |= lnd_check_one_mines(llp, 1);
stopping = 1;
emp_remque(qp);
free(qp);
}
} }
return stopping; return stopping;
} }
@ -715,8 +711,11 @@ lnd_check_one_mines(struct ulist *llp, int with_eng)
sect.sct_mines--; sect.sct_mines--;
putsect(&sect); putsect(&sect);
putland(llp->unit.land.lnd_uid, &llp->unit.land); putland(llp->unit.land.lnd_uid, &llp->unit.land);
if (!llp->unit.land.lnd_own) if (!llp->unit.land.lnd_own) {
return 1; emp_remque(&llp->queue);
free(llp);
}
return 1;
} }
return 0; return 0;
} }
@ -726,18 +725,12 @@ lnd_check_mines(struct emp_qelem *land_list)
{ {
struct emp_qelem *qp; struct emp_qelem *qp;
struct emp_qelem *next; struct emp_qelem *next;
struct ulist *llp;
int stopping = 0; int stopping = 0;
int with_eng = !!lnd_find_capable(land_list, L_ENGINEER); int with_eng = !!lnd_find_capable(land_list, L_ENGINEER);
for (qp = land_list->q_back; qp != land_list; qp = next) { for (qp = land_list->q_back; qp != land_list; qp = next) {
next = qp->q_back; next = qp->q_back;
llp = (struct ulist *)qp; stopping |= lnd_check_one_mines((struct ulist *)qp, with_eng);
if (lnd_check_one_mines(llp, with_eng)) {
stopping = 1;
emp_remque(qp);
free(qp);
}
} }
return stopping; return stopping;
} }

View file

@ -298,11 +298,7 @@ shp_sweep(struct emp_qelem *ship_list, int explicit, int takemob,
mlp->unit.ship.shp_item[I_SHELL] = shells; mlp->unit.ship.shp_item[I_SHELL] = shells;
putship(mlp->unit.ship.shp_uid, &mlp->unit.ship); putship(mlp->unit.ship.shp_uid, &mlp->unit.ship);
putsect(&sect); putsect(&sect);
if (shp_check_one_mines(mlp)) { stopping |= shp_check_one_mines(mlp);
stopping = 1;
emp_remque(qp);
free(qp);
}
} }
if (changed) if (changed)
writemap(actor); writemap(actor);
@ -328,8 +324,11 @@ shp_check_one_mines(struct ulist *mlp)
writemap(actor); writemap(actor);
putsect(&sect); putsect(&sect);
putship(mlp->unit.ship.shp_uid, &mlp->unit.ship); putship(mlp->unit.ship.shp_uid, &mlp->unit.ship);
if (!mlp->unit.ship.shp_own) if (!mlp->unit.ship.shp_own) {
return 1; emp_remque(&mlp->queue);
free(mlp);
}
return 1;
} }
return 0; return 0;
} }
@ -339,17 +338,11 @@ shp_check_mines(struct emp_qelem *ship_list)
{ {
struct emp_qelem *qp; struct emp_qelem *qp;
struct emp_qelem *next; struct emp_qelem *next;
struct ulist *mlp;
int stopping = 0; int stopping = 0;
for (qp = ship_list->q_back; qp != ship_list; qp = next) { for (qp = ship_list->q_back; qp != ship_list; qp = next) {
next = qp->q_back; next = qp->q_back;
mlp = (struct ulist *)qp; stopping |= shp_check_one_mines((struct ulist *)qp);
if (shp_check_one_mines(mlp)) {
stopping = 1;
emp_remque(qp);
free(qp);
}
} }
return stopping; return stopping;
} }

View file

@ -29,7 +29,8 @@ navi 31/30 jX
iyh iyh
| lose crew, by hitting mines in 11,-5 | lose crew, by hitting mines in 11,-5
| at least one hit must lose crew; use __cmd to force it if necessary | at least one hit must lose crew; use __cmd to force it if necessary
navi 32/33/34/35/36/37/38/39 jiyh navi 32/33/34/35/36/37/38/39 jX
iyh
| TODO sink ship at navi prompt, changing leader | TODO sink ship at navi prompt, changing leader
| TODO slap bridge onto ship at navi prompt | TODO slap bridge onto ship at navi prompt
|| sector entry || sector entry
@ -124,5 +125,8 @@ navi 129 nmh
navi 135/130/131/136/137/138/139 navi 135/130/131/136/137/138/139
j j
| implicit sweep, not all capable | implicit sweep, not all capable
mmmh mf
mf
mf
h
|| TODO interdiction || TODO interdiction

View file

@ -28,7 +28,8 @@ iyh
| lose crew, by hitting mines in 8,6 | lose crew, by hitting mines in 8,6
| at least one hit must lose crew; use __cmd to force it if necessary | at least one hit must lose crew; use __cmd to force it if necessary
__cmd added -1 0 0 __cmd added -1 0 0
march 32/33/34/35/36/37/38/39 jiyh march 32/33/34/35/36/37/38/39 jX
iyh
| TODO destroy land unit at march prompt, changing leader | TODO destroy land unit at march prompt, changing leader
| TODO kidnap at march prompt | TODO kidnap at march prompt
|| sector entry || sector entry
@ -124,5 +125,8 @@ mh
march 135/130/131/136/137/138/139 march 135/130/131/136/137/138/139
j j
| implicit sweep, not all capable | implicit sweep, not all capable
mmmh mf
mf
mf
h
|| TODO interdiction || TODO interdiction

View file

@ -139,7 +139,7 @@
Play#1 output Play#1 1 30 pt patrol boat 11,-5 100% 2 0 0 0 0 0 0 117 40 Play#1 output Play#1 1 30 pt patrol boat 11,-5 100% 2 0 0 0 0 0 0 117 40
Play#1 output Play#1 1 pt patrol boat (#30) stopped at 10,-6 Play#1 output Play#1 1 pt patrol boat (#30) stopped at 10,-6
Play#1 output Play#1 6 0 629 Play#1 output Play#1 6 0 629
Play#1 input navi 32/33/34/35/36/37/38/39 jiyh Play#1 input navi 32/33/34/35/36/37/38/39 jX
Play#1 command navigate Play#1 command navigate
Play#1 output Play#1 1 Flagship is pt patrol boat (#32) Play#1 output Play#1 1 Flagship is pt patrol boat (#32)
Play#1 output Play#1 1 Kawhomp! Mine detected in 11,-5! Play#1 output Play#1 1 Kawhomp! Mine detected in 11,-5!
@ -157,6 +157,11 @@
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 pt patrol boat (#39) takes 36 Play#1 output Play#1 1 pt patrol boat (#39) takes 36
Play#1 output Play#1 1 pt patrol boat (#38) is crewless & stays in 11,-5 Play#1 output Play#1 1 pt patrol boat (#38) is crewless & stays in 11,-5
Play#1 output Play#1 1 . .
Play#1 output Play#1 1 . X .
Play#1 output Play#1 1 . .
Play#1 output Play#1 4 <117.8:75.0: 11,-5>
Play#1 input iyh
Play#1 output Play#1 1 shp# ship type x,y fl eff mil sh gun pn he xl ln mob tech Play#1 output Play#1 1 shp# ship type x,y fl eff mil sh gun pn he xl ln mob tech
Play#1 output Play#1 1 32 pt patrol boat 11,-5 75% 1 0 0 0 0 0 0 88 40 Play#1 output Play#1 1 32 pt patrol boat 11,-5 75% 1 0 0 0 0 0 0 88 40
Play#1 output Play#1 1 33 pt patrol boat 11,-5 80% 1 0 0 0 0 0 0 94 40 Play#1 output Play#1 1 33 pt patrol boat 11,-5 80% 1 0 0 0 0 0 0 94 40
@ -646,7 +651,7 @@
Play#1 output Play#1 1 . X . Play#1 output Play#1 1 . X .
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 mf
Play#1 output Play#1 1 Approaching minefield at 11,-5... 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!
@ -658,6 +663,11 @@
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 . .
Play#1 output Play#1 1 . X .
Play#1 output Play#1 1 . .
Play#1 output Play#1 4 <117.8:47.0: 11,-5>
Play#1 input mf
Play#1 output Play#1 1 Approaching minefield at 11,-5... 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...
@ -671,6 +681,11 @@
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 . .
Play#1 output Play#1 1 . X .
Play#1 output Play#1 1 . .
Play#1 output Play#1 4 <117.8:18.0: 11,-5>
Play#1 input mf
Play#1 output Play#1 1 Approaching minefield at 11,-5... 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...
@ -679,6 +694,11 @@
Play#1 output Play#1 1 ms minesweeper (#130) takes 10 Play#1 output Play#1 1 ms minesweeper (#130) takes 10
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 . .
Play#1 output Play#1 1 . X .
Play#1 output Play#1 1 . .
Play#1 output Play#1 4 <117.8:-11.1: 11,-5>
Play#1 input h
Play#1 output Play#1 1 pt patrol boat (#135) stopped at 11,-5 Play#1 output Play#1 1 pt patrol boat (#135) stopped at 11,-5
Play#1 output Play#1 1 ms minesweeper (#130) stopped at 11,-5 Play#1 output Play#1 1 ms minesweeper (#130) stopped at 11,-5
Play#1 output Play#1 1 ms minesweeper (#131) stopped at 11,-5 Play#1 output Play#1 1 ms minesweeper (#131) stopped at 11,-5
@ -813,7 +833,7 @@
Play#1 input __cmd added -1 0 0 Play#1 input __cmd added -1 0 0
Play#1 command __cmd Play#1 command __cmd
Play#1 output Play#1 6 0 582 Play#1 output Play#1 6 0 582
Play#1 input march 32/33/34/35/36/37/38/39 jiyh Play#1 input march 32/33/34/35/36/37/38/39 jX
Play#1 command march Play#1 command march
Play#1 output Play#1 1 Leader is cav cavalry #32 Play#1 output Play#1 1 Leader is cav cavalry #32
Play#1 output Play#1 1 Blammo! Landmines detected in 8,6! Play#1 output Play#1 1 Blammo! Landmines detected in 8,6!
@ -831,6 +851,11 @@
Play#1 output Play#1 1 Blammo! Landmines detected in 8,6! Play#1 output Play#1 1 Blammo! Landmines detected in 8,6!
Play#1 output Play#1 1 cav cavalry #39 takes 16 Play#1 output Play#1 1 cav cavalry #39 takes 16
Play#1 output Play#1 1 cav cavalry #36 has no mil on it to guide it & stays in 8,6 Play#1 output Play#1 1 cav cavalry #36 has no mil on it to guide it & stays in 8,6
Play#1 output Play#1 1 m m
Play#1 output Play#1 1 m m m
Play#1 output Play#1 1 m m
Play#1 output Play#1 4 <104.7:81.0: 8,6>
Play#1 input iyh
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 lnd# land type x,y a eff mil sh gun xl ln mu tech retr
Play#1 output Play#1 1 32 cav cavalry 8,6 87% 1 0 0 0 0 90 30 42% Play#1 output Play#1 1 32 cav cavalry 8,6 87% 1 0 0 0 0 90 30 42%
Play#1 output Play#1 1 33 cav cavalry 8,6 100% 1 0 0 0 0 104 30 42% Play#1 output Play#1 1 33 cav cavalry 8,6 100% 1 0 0 0 0 104 30 42%
@ -1275,7 +1300,7 @@
Play#1 output Play#1 1 m m m Play#1 output Play#1 1 m m m
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 mf
Play#1 output Play#1 1 Approaching minefield at 8,6... 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...
@ -1285,6 +1310,12 @@
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 Changing leader to eng engineer #130
Play#1 output Play#1 1 m m
Play#1 output Play#1 1 m m m
Play#1 output Play#1 1 m m
Play#1 output Play#1 4 <104.7:73.6: 8,6>
Play#1 input mf
Play#1 output Play#1 1 Approaching minefield at 8,6... 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...
@ -1294,6 +1325,11 @@
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 m m
Play#1 output Play#1 1 m m m
Play#1 output Play#1 1 m m
Play#1 output Play#1 4 <104.7:61.0: 8,6>
Play#1 input mf
Play#1 output Play#1 1 Approaching minefield at 8,6... 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...
@ -1304,13 +1340,19 @@
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 cav cavalry #135 stopped at 8,6 Play#1 output Play#1 1 Changing leader to eng engineer #131
Play#1 output Play#1 1 eng engineer #130 stopped at 8,6 Play#1 output Play#1 1 m m
Play#1 output Play#1 1 m m m
Play#1 output Play#1 1 m m
Play#1 output Play#1 4 <104.7:48.6: 8,6>
Play#1 input h
Play#1 output Play#1 1 eng engineer #131 stopped at 8,6 Play#1 output Play#1 1 eng engineer #131 stopped at 8,6
Play#1 output Play#1 1 cav cavalry #136 stopped at 8,6 Play#1 output Play#1 1 cav cavalry #136 stopped at 8,6
Play#1 output Play#1 1 cav cavalry #137 stopped at 8,6 Play#1 output Play#1 1 cav cavalry #137 stopped at 8,6
Play#1 output Play#1 1 cav cavalry #138 stopped at 8,6 Play#1 output Play#1 1 cav cavalry #138 stopped at 8,6
Play#1 output Play#1 1 cav cavalry #139 stopped at 8,6 Play#1 output Play#1 1 cav cavalry #139 stopped at 8,6
Play#1 output Play#1 1 cav cavalry #135 stopped at 8,6
Play#1 output Play#1 1 eng engineer #130 stopped at 8,6
Play#1 output Play#1 6 0 547 Play#1 output Play#1 6 0 547
Play#1 input ctld Play#1 input ctld
Play#1 output Play#1 1 Bye-bye Play#1 output Play#1 1 Bye-bye