From 4ea1d3acff4e4b8e07f66323ef4c623bc7ace476 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 20 Sep 2008 13:21:48 -0400 Subject: [PATCH] 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. --- src/lib/commands/reco.c | 1 - src/lib/subs/aircombat.c | 8 +++----- src/lib/subs/mission.c | 4 ---- src/lib/subs/plnsub.c | 5 ----- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/lib/commands/reco.c b/src/lib/commands/reco.c index ebc9e06e0..26c145c45 100644 --- a/src/lib/commands/reco.c +++ b/src/lib/commands/reco.c @@ -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)) { diff --git a/src/lib/subs/aircombat.c b/src/lib/subs/aircombat.c index 9d4256972..10079cecb 100644 --- a/src/lib/subs/aircombat.c +++ b/src/lib/subs/aircombat.c @@ -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,8 +349,7 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list, } } out: - if (mission_flags & P_A) - free_shiplist(&head); + free_shiplist(&head); for (cn = 1; cn < MAXNOC; cn++) { if (gotilist[cn]) pln_put(&ilist[cn]); diff --git a/src/lib/subs/mission.c b/src/lib/subs/mission.c index 3b79c4a45..a2a178f57 100644 --- a/src/lib/subs/mission.c +++ b/src/lib/subs/mission.c @@ -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; diff --git a/src/lib/subs/plnsub.c b/src/lib/subs/plnsub.c index b66947309..cbbd57920 100644 --- a/src/lib/subs/plnsub.c +++ b/src/lib/subs/plnsub.c @@ -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; -- 2.43.0