Fix mixed ASW patrols

A reconnaissance patrol (recon and sweep) uses sonar when ASW planes
participate.  ac_encounter() enabled sonar when P_A was in
mission_flags.  These get computed by pln_arm() and callers.  However,
they set P_A only when *all* planes were capable, including escorts.

Fix by checking actual plane capabilities instead.  Closes #1389451.
This commit is contained in:
Markus Armbruster 2008-09-20 13:21:48 -04:00
parent e3d4bb0080
commit 4ea1d3acff
4 changed files with 3 additions and 15 deletions

View file

@ -101,7 +101,6 @@ reco(void)
*/
mission_flags |= P_X; /* stealth (shhh) */
mission_flags |= P_H; /* gets turned off if not all choppers */
mission_flags |= P_A;
mission_flags = pln_arm(&bomb_list, ap_to_target, 'r',
0, P_S | P_I, mission_flags);
if (QEMPTY(&bomb_list)) {

View file

@ -127,7 +127,7 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
PR(plane_owner, "\nSPY Plane report\n");
PRdate(plane_owner);
sathead();
} else if (mission_flags & P_A) {
} else if (flags & P_A) {
PR(plane_owner, "\nAnti-Sub Patrol report\n");
} else {
PR(plane_owner, "\nReconnaissance report\n");
@ -153,9 +153,8 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
dchr[sect.sct_type].d_name, xyas(x, y, plane_owner));
if (mission_flags & PM_S)
plane_sweep(bomb_list, x, y);
if (mission_flags & P_A) {
if (flags & P_A)
plane_sona(bomb_list, x, y, &head);
}
changed += map_set(plane_owner,
sect.sct_x, sect.sct_y,
dchr[sect.sct_type].d_mnem, 0);
@ -350,7 +349,6 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
}
}
out:
if (mission_flags & P_A)
free_shiplist(&head);
for (cn = 1; cn < MAXNOC; cn++) {
if (gotilist[cn])

View file

@ -881,10 +881,6 @@ mission_pln_arm(struct emp_qelem *list, coord x, coord y, int dist,
if (!(plp->pcp->pl_flags & P_X))
/* no stealth on this mission */
mission_flags &= ~P_X;
if (!(plp->pcp->pl_flags & P_A)) {
/* no asw on this mission */
mission_flags &= ~P_A;
}
if (!(plp->pcp->pl_flags & P_MINE)) {
/* no asw on this mission */
mission_flags &= ~P_MINE;

View file

@ -594,11 +594,6 @@ pln_arm(struct emp_qelem *list, int dist, char mission, struct ichrstr *ip,
if (!(plp->pcp->pl_flags & P_X))
/* no stealth on this mission */
mission_flags &= ~P_X;
if (!(plp->pcp->pl_flags & P_A)) {
/* no asw on this mission */
mission_flags &= ~P_A;
/* FIXME escorts turn ASW patrol into ordinary recon */
}
if (!(plp->pcp->pl_flags & P_MINE)) {
/* no asw on this mission */
mission_flags &= ~P_MINE;