]> git.pond.sub.org Git - empserver/commitdiff
Fix SAM interception for intercepts other than the first
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 24 Sep 2008 22:49:54 +0000 (18:49 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 1 Feb 2009 16:14:39 +0000 (17:14 +0100)
A country's SAMs launched only in the first interception of a sortie.
That was because ac_intercept() made sam_intercept() delete all SAMs
from the list of available interceptors.  sam_intercept() also deleted
any SAMs out of range.  Don't do that, delete unused SAMs along with
other unused interceptors on return from ac_encounter().

src/lib/subs/aircombat.c

index 8bb544bb4ac797d5507f9753e6e91b3a66d4e20a..400ddcdbf90f211d4715d9c3329df3751b26f7be 100644 (file)
@@ -348,11 +348,8 @@ sam_intercept(struct emp_qelem *att_list, struct emp_qelem *def_list,
                continue;
 
            if (dplp->plane.pln_range <
                continue;
 
            if (dplp->plane.pln_range <
-               mapdist(x, y, dplp->plane.pln_x, dplp->plane.pln_y)) {
-               emp_remque(dqp);
-               free(dqp);
+               mapdist(x, y, dplp->plane.pln_x, dplp->plane.pln_y))
                continue;
                continue;
-           }
            if (CANT_HAPPEN(dplp->plane.pln_flags & PLN_LAUNCHED)
                || mission_pln_equip(dplp, 0, P_F, 0) < 0) {
                emp_remque(dqp);
            if (CANT_HAPPEN(dplp->plane.pln_flags & PLN_LAUNCHED)
                || mission_pln_equip(dplp, 0, P_F, 0) < 0) {
                emp_remque(dqp);
@@ -408,7 +405,7 @@ ac_intercept(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
     plane_owner = plp->plane.pln_own;
 
     sam_intercept(bomb_list, def_list, def_own, plane_owner, x, y, 0);
     plane_owner = plp->plane.pln_own;
 
     sam_intercept(bomb_list, def_list, def_own, plane_owner, x, y, 0);
-    sam_intercept(esc_list, def_list, def_own, plane_owner, x, y, 1);
+    sam_intercept(esc_list, def_list, def_own, plane_owner, x, y, 0);
 
     att_count = 0;
     for (qp = bomb_list->q_forw; qp != bomb_list; qp = qp->q_forw)
 
     att_count = 0;
     for (qp = bomb_list->q_forw; qp != bomb_list; qp = qp->q_forw)