Fix bugs in tracking of planes flying a sortie
Commit 7ca4f412
fixed tracking of planes flying a sortie by marking
them with flag PLN_LAUNCHED. It failed to write SAMs and planes
flying missions back to the plane file, in sam_intercept() and
mission_pln_arm(). The only known problem with that is fairly
harmless: when the mission damages planes on the ground, the planes
flying it get damaged as if they were still sitting in their bases,
but the damage gets wiped out when they land.
The same issue applies to missiles. So they need to be tracked as
well. Do that in msl_hit().
While there, remove a few redundant PLN_LAUNCHED sanity checks.
This commit is contained in:
parent
4e9e58bf6a
commit
7bc63871c6
4 changed files with 7 additions and 4 deletions
|
@ -404,13 +404,14 @@ sam_intercept(struct emp_qelem *att_list, struct emp_qelem *def_list,
|
|||
free(dqp);
|
||||
continue;
|
||||
}
|
||||
if (mission_pln_equip(dplp, 0, P_F, 0) < 0) {
|
||||
if (CANT_HAPPEN(dplp->plane.pln_flags & PLN_LAUNCHED)
|
||||
|| mission_pln_equip(dplp, 0, P_F, 0) < 0) {
|
||||
emp_remque(dqp);
|
||||
free(dqp);
|
||||
continue;
|
||||
}
|
||||
CANT_HAPPEN(dplp->plane.pln_flags & PLN_LAUNCHED);
|
||||
dplp->plane.pln_flags |= PLN_LAUNCHED;
|
||||
putplane(dplp->plane.pln_uid, &dplp->plane);
|
||||
if (first) {
|
||||
first = 0;
|
||||
PR(plane_owner, "%s launches SAMs!\n", cname(def_own));
|
||||
|
|
|
@ -969,9 +969,9 @@ mission_pln_arm(struct emp_qelem *list, coord x, coord y, int dist,
|
|||
mission_flags &= ~P_MINE;
|
||||
}
|
||||
|
||||
CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED);
|
||||
pp->pln_flags |= PLN_LAUNCHED;
|
||||
pp->pln_mobil -= pln_mobcost(dist, pp, flags);
|
||||
putplane(pp->pln_uid, pp);
|
||||
}
|
||||
return mission_flags;
|
||||
}
|
||||
|
|
|
@ -124,6 +124,9 @@ msl_hit(struct plnstr *pp, int hardtarget, int type, int news_item,
|
|||
return 0;
|
||||
}
|
||||
|
||||
CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED);
|
||||
pp->pln_flags |= PLN_LAUNCHED;
|
||||
putplane(pp->pln_uid, pp);
|
||||
mpr(pp->pln_own, "\tSHWOOOOOSH! Missile launched!\n");
|
||||
|
||||
if (pp->pln_nuketype != -1)
|
||||
|
|
|
@ -587,7 +587,6 @@ pln_arm(struct emp_qelem *list, int dist, char mission, struct ichrstr *ip,
|
|||
mission_flags &= ~P_MINE;
|
||||
/* FIXME no effect */
|
||||
}
|
||||
CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED);
|
||||
pp->pln_flags |= PLN_LAUNCHED;
|
||||
pp->pln_mobil -= pln_mobcost(dist, pp, flags);
|
||||
putplane(pp->pln_uid, pp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue