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

@ -50,6 +50,7 @@ static void *nsc_ver_maxnoc(struct valstr *, struct natstr *, void *);
static void *nsc_sct_terr(struct valstr *, struct natstr *, void *);
static void *nsc_pln_att(struct valstr *, struct natstr *, void *);
static void *nsc_pln_def(struct valstr *, struct natstr *, void *);
static void *nsc_pln_nuketype(struct valstr *, struct natstr *, void *);
static void *nsc_lnd_att(struct valstr *, struct natstr *, void *);
static void *nsc_lnd_def(struct valstr *, struct natstr *, void *);
static void *nsc_lnd_vul(struct valstr *, struct natstr *, void *);
@ -294,13 +295,13 @@ struct castr plane_ca[] = {
{"ship", fldoff(pln_ship), NSC_SHORT, 0, NULL, EF_BAD, 0},
{"land", fldoff(pln_land), NSC_SHORT, 0, NULL, EF_BAD, 0},
{"harden", fldoff(pln_harden), NSC_CHAR, 0, NULL, EF_BAD, 0},
{"nuketype", fldoff(pln_nuketype), NSC_CHAR, 0, NULL, EF_BAD, 0},
{"flags", fldoff(pln_flags), NSC_CHAR, 0, NULL,
EF_PLANE_FLAGS, NSC_BITS},
{"access", fldoff(pln_access), NSC_SHORT, 0, NULL, EF_BAD, 0},
{"theta", fldoff(pln_theta), NSC_FLOAT, 0, NULL, EF_BAD, 0},
{"att", 0, NSC_LONG, 0, nsc_pln_att, EF_BAD, NSC_EXTRA},
{"def", 0, NSC_LONG, 0, nsc_pln_def, EF_BAD, NSC_EXTRA},
{"nuketype", 0, NSC_LONG, 0, nsc_pln_nuketype, EF_BAD, NSC_EXTRA},
{NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0}
#undef CURSTR
};
@ -782,6 +783,14 @@ nsc_pln_att(struct valstr *val, struct natstr *np, void *ptr)
return NULL;
}
static void *
nsc_pln_nuketype(struct valstr *val, struct natstr *np, void *ptr)
{
struct nukstr *nukp = getnukep(nuk_on_plane(ptr));
val->val_as.lng = nukp ? nukp->nuk_type : -1;
return NULL;
}
static void *
nsc_lnd_att(struct valstr *val, struct natstr *np, void *ptr)
{