Clarify how perform_mission() uses missiles
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 11 Oct 2009 15:58:00 +0000 (11:58 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 13 Dec 2009 07:04:08 +0000 (08:04 +0100)
Interdiction of ships and land units with missiles happens elsewhere.
Oops when perform_mission() strays on that turf.

src/lib/subs/mission.c

index b6188472531179a23eee32aba51109f772fd266d..8012db2c00ecd97e18326ad1176678356853639e 100644 (file)
@@ -548,13 +548,21 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
        }
     }
 
+    /*
+     * Missiles, except for interdiction of ships or land units,
+     * because that happens elsewhere, in shp_missile_interdiction()
+     * and lnd_missile_interdiction().
+     */
     air_dam = 0;
     for (qp = missiles.q_back; qp != &missiles; qp = newqp) {
        newqp = qp->q_back;
        plp = (struct plist *)qp;
 
-       if (air_dam < 100 && mission_pln_equip(plp, NULL, 'p') >= 0) {
-           if (msl_hit(&plp->plane, hardtarget, EF_SECTOR,
+       if (air_dam < 100
+           && !CANT_HAPPEN(hardtarget != SECT_HARDTARGET
+                           || (plp->pcp->pl_flags & P_MAR))
+           && mission_pln_equip(plp, NULL, 'p') >= 0) {
+           if (msl_hit(&plp->plane, SECT_HARDTARGET, EF_SECTOR,
                        N_SCT_MISS, N_SCT_SMISS,
                        "sector", x, y, victim)) {
                dam2 = pln_damage(&plp->plane, 'p', 1);