From 7b4c0d171f07d16f1b77f5646db9ac3a7ee6040b Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 24 Sep 2008 18:49:54 -0400 Subject: [PATCH] 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(). --- src/lib/subs/aircombat.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/lib/subs/aircombat.c b/src/lib/subs/aircombat.c index 8bb544bb4..400ddcdbf 100644 --- a/src/lib/subs/aircombat.c +++ b/src/lib/subs/aircombat.c @@ -348,11 +348,8 @@ sam_intercept(struct emp_qelem *att_list, struct emp_qelem *def_list, 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; - } 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); - 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) -- 2.43.0