Get rid of struct plnstr member pln_nuktype

pln_nuktype is redundant; it can be computed from the nuke's
nuk_plane.

Make plane selector nuketype virtual and NSC_EXTRA.  It should have
been NSC_EXTRA all along.  This changes xdump plane.

Don't set it in arm(), disarm(), build_plane(), pln_damage() and
nuk_fixup().  The latter no longer does anything, remove it.

Deprecate edit key 'n' in doplane(), and don't show it in pr_plane().
The key never made much sense.

eff_bomb(), comm_bomb(), ship_bomb(), plane_bomb(), land_bomb(),
strat_bomb(), mission_pln_equip(), air_damage(), msl_hit(),
pln_equip() tested pln_nuketype to check whether a plane carries a
nuke.  Test nuk_on_plane() instead.

pdump(), plan(), trade_desc() print whether and what kind of nuke a
plane carries.  Adapt that to use nuk_on_plane().
This commit is contained in:
Markus Armbruster 2008-09-06 22:15:41 -04:00
parent 4086c25a15
commit 8b1470e3a8
13 changed files with 40 additions and 56 deletions

View file

@ -42,6 +42,7 @@
#include "item.h"
#include "land.h"
#include "news.h"
#include "nuke.h"
#include "optlist.h"
#include "path.h"
#include "plane.h"
@ -342,7 +343,7 @@ eff_bomb(struct emp_qelem *list, struct sctstr *target)
plp = (struct plist *)qp;
if ((plp->pcp->pl_flags & P_C) && (!(plp->pcp->pl_flags & P_T)))
continue;
if (plp->bombs || plp->plane.pln_nuketype != -1)
if (plp->bombs || nuk_on_plane(&plp->plane) >= 0)
dam += pln_damage(&plp->plane, target->sct_x, target->sct_y,
'p', &nukedam, 1);
}
@ -419,7 +420,7 @@ comm_bomb(struct emp_qelem *list, struct sctstr *target)
plp = (struct plist *)qp;
if ((plp->pcp->pl_flags & P_C) && (!(plp->pcp->pl_flags & P_T)))
continue;
if (plp->bombs || plp->plane.pln_nuketype != -1)
if (plp->bombs || nuk_on_plane(&plp->plane) >= 0)
dam += pln_damage(&plp->plane, target->sct_x, target->sct_y,
'p', &nukedam, 1);
}
@ -532,7 +533,7 @@ ship_bomb(struct emp_qelem *list, struct sctstr *target)
}
dam = 0;
if (plp->plane.pln_nuketype != -1)
if (nuk_on_plane(&plp->plane) >= 0)
hitchance = 100;
else {
hitchance = pln_hitchance(&plp->plane,
@ -636,7 +637,7 @@ plane_bomb(struct emp_qelem *list, struct sctstr *target)
if (planeno < 0)
continue;
dam = 0;
if (plp->plane.pln_nuketype != -1)
if (nuk_on_plane(&plp->plane) >= 0)
hitchance = 100;
else {
hitchance = pln_hitchance(&plp->plane, 0, EF_PLANE);
@ -747,7 +748,7 @@ land_bomb(struct emp_qelem *list, struct sctstr *target)
}
dam = 0;
if (plp->plane.pln_nuketype != -1)
if (nuk_on_plane(&plp->plane) >= 0)
hitchance = 100;
else {
hitchance = pln_hitchance(&plp->plane,
@ -796,7 +797,7 @@ strat_bomb(struct emp_qelem *list, struct sctstr *target)
plp = (struct plist *)qp;
if ((plp->pcp->pl_flags & P_C) && (!(plp->pcp->pl_flags & P_T)))
continue;
if (plp->bombs || plp->plane.pln_nuketype != -1)
if (plp->bombs || nuk_on_plane(&plp->plane) >= 0)
dam += pln_damage(&plp->plane, target->sct_x, target->sct_y,
's', &nukedam, 1);
}