Factor out a single plane's end of sortie into new pln_put1()
Use it in pln_put() and ac_planedamage(). This changes ac_planedamage() to deal with a destroyed airbase. Before, aborted planes happily landed there. This bug could not actually bite, because the code neither yields nor does damage to potential airbases between checking the landing airbase before takeoff and aborting planes in ac_planedamage(). It changes pln_put() to cope with dead planes. Before, it made them land as if they lived, fortunately without ill effects (complaints about not being able to land were suppressed for dead planes). ac_planedamage() removes dead planes, but pinflak_planedamage() doesn't, and these end up in pln_put(). pinflak_planedamage() no longer has to take shot down planes off their carriers, because pln_put() now takes care of that.
This commit is contained in:
parent
1a75f8fe04
commit
5e930f5fdf
4 changed files with 49 additions and 66 deletions
|
@ -844,8 +844,6 @@ pinflak_planedamage(struct plnstr *pp, struct plchrstr *pcp, natid from,
|
|||
int disp;
|
||||
char dmess[255];
|
||||
int eff;
|
||||
struct shpstr ship;
|
||||
struct lndstr land;
|
||||
natid plane_owner;
|
||||
int dam;
|
||||
|
||||
|
@ -873,14 +871,6 @@ pinflak_planedamage(struct plnstr *pp, struct plchrstr *pcp, natid from,
|
|||
if (disp == 1) {
|
||||
if (from != 0)
|
||||
nreport(from, N_DOWN_PLANE, pp->pln_own, 1);
|
||||
if (pp->pln_ship >= 0) {
|
||||
getship(pp->pln_ship, &ship);
|
||||
take_plane_off_ship(pp, &ship);
|
||||
}
|
||||
if (pp->pln_land >= 0) {
|
||||
getland(pp->pln_land, &land);
|
||||
take_plane_off_land(pp, &land);
|
||||
}
|
||||
}
|
||||
putplane(pp->pln_uid, pp);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue