Fix SAM interception for intercepts other than the first

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().
This commit is contained in:
Markus Armbruster 2008-09-24 18:49:54 -04:00
parent b54454fbc4
commit 7b4c0d171f

View file

@ -348,11 +348,8 @@ sam_intercept(struct emp_qelem *att_list, struct emp_qelem *def_list,
continue; continue;
if (dplp->plane.pln_range < if (dplp->plane.pln_range <
mapdist(x, y, dplp->plane.pln_x, dplp->plane.pln_y)) { mapdist(x, y, dplp->plane.pln_x, dplp->plane.pln_y))
emp_remque(dqp);
free(dqp);
continue; continue;
}
if (CANT_HAPPEN(dplp->plane.pln_flags & PLN_LAUNCHED) if (CANT_HAPPEN(dplp->plane.pln_flags & PLN_LAUNCHED)
|| mission_pln_equip(dplp, 0, P_F, 0) < 0) { || mission_pln_equip(dplp, 0, P_F, 0) < 0) {
emp_remque(dqp); 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; plane_owner = plp->plane.pln_own;
sam_intercept(bomb_list, def_list, def_own, plane_owner, x, y, 0); 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; att_count = 0;
for (qp = bomb_list->q_forw; qp != bomb_list; qp = qp->q_forw) for (qp = bomb_list->q_forw; qp != bomb_list; qp = qp->q_forw)