]> git.pond.sub.org Git - empserver/commitdiff
Fix mixed ASW patrols
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 20 Sep 2008 17:21:48 +0000 (13:21 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 1 Feb 2009 16:14:38 +0000 (17:14 +0100)
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
src/lib/subs/aircombat.c
src/lib/subs/mission.c
src/lib/subs/plnsub.c

index ebc9e06e0de6ce639f7ea71cc5b5af34744296fc..26c145c45680cb36c4d4a83c773889515ea7d72f 100644 (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)) {
index 9d4256972d3325087e4f305bc96365e4af54efc1..10079cecb1c99643a3c2014c52f04439212b43f9 100644 (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,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]);
index 3b79c4a455d5704e1773311b33d8c2c32c89c9aa..a2a178f57a58ec74d46678a22727767631264b9b 100644 (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;
index b6694730984a3f54d0a791fef75ee131d5ba28ed..cbbd5792007b6df8f6308756e969509c0f743572 100644 (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;