New shp_mission_interdiction()
Factored out of shp_interdict(). No functional change.
This commit is contained in:
parent
d4f1e02273
commit
cd8fe31eda
1 changed files with 19 additions and 14 deletions
|
@ -640,6 +640,22 @@ shp_fort_interdiction(struct emp_qelem *list, coord newx, coord newy,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
shp_mission_interdiction(struct emp_qelem *list, coord x, coord y,
|
||||||
|
natid victim, int subs)
|
||||||
|
{
|
||||||
|
char *what = subs ? "subs" : "ships";
|
||||||
|
int wantflags = subs ? M_SUB : 0;
|
||||||
|
int nowantflags = subs ? 0 : M_SUB;
|
||||||
|
|
||||||
|
return shp_damage(list,
|
||||||
|
unit_interdict(x, y, victim, what,
|
||||||
|
shp_easiest_target(list,
|
||||||
|
wantflags, nowantflags),
|
||||||
|
MI_INTERDICT),
|
||||||
|
wantflags, nowantflags, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
shp_interdict(struct emp_qelem *list, coord newx, coord newy, natid victim)
|
shp_interdict(struct emp_qelem *list, coord newx, coord newy, natid victim)
|
||||||
{
|
{
|
||||||
|
@ -649,23 +665,12 @@ shp_interdict(struct emp_qelem *list, coord newx, coord newy, natid victim)
|
||||||
stopping |= shp_fort_interdiction(list, newx, newy, victim);
|
stopping |= shp_fort_interdiction(list, newx, newy, victim);
|
||||||
|
|
||||||
if (shp_contains(list, newx, newy, 0, M_SUB)) {
|
if (shp_contains(list, newx, newy, 0, M_SUB)) {
|
||||||
stopping |=
|
stopping |= shp_mission_interdiction(list, newx, newy, victim, 0);
|
||||||
shp_damage(list,
|
|
||||||
unit_interdict(newx, newy, victim, "ships",
|
|
||||||
shp_easiest_target(list, 0, M_SUB),
|
|
||||||
MI_INTERDICT),
|
|
||||||
0, M_SUB, newx, newy);
|
|
||||||
stopping |= shp_missile_interdiction(list, newx, newy, victim);
|
stopping |= shp_missile_interdiction(list, newx, newy, victim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (shp_contains(list, newx, newy, M_SUB, 0)) {
|
if (shp_contains(list, newx, newy, M_SUB, 0))
|
||||||
stopping |=
|
stopping |= shp_mission_interdiction(list, newx, newy, victim, 1);
|
||||||
shp_damage(list,
|
|
||||||
unit_interdict(newx, newy, victim, "subs",
|
|
||||||
shp_easiest_target(list, M_SUB, 0),
|
|
||||||
MI_SINTERDICT),
|
|
||||||
M_SUB, 0, newx, newy);
|
|
||||||
}
|
|
||||||
return stopping;
|
return stopping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue