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:
parent
4086c25a15
commit
8b1470e3a8
13 changed files with 40 additions and 56 deletions
|
@ -1008,7 +1008,7 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, int flags,
|
|||
switch (mission) {
|
||||
case 's': /* strategic bomb */
|
||||
case 'p': /* pinpoint bomb */
|
||||
if (pp->pln_nuketype == -1) {
|
||||
if (nuk_on_plane(pp) < 0) {
|
||||
itype = I_SHELL;
|
||||
needed = load;
|
||||
}
|
||||
|
@ -1168,7 +1168,7 @@ air_damage(struct emp_qelem *bombers, coord x, coord y, int mission,
|
|||
prplane(pp), cname(victim), s, xyas(x, y, pp->pln_own));
|
||||
}
|
||||
hitchance = pln_hitchance(pp, hardtarget, EF_SHIP);
|
||||
if (plp->plane.pln_nuketype != -1)
|
||||
if (nuk_on_plane(&plp->plane) >= 0)
|
||||
hitchance = 100;
|
||||
else if (hardtarget != SECT_HARDTARGET)
|
||||
wu(0, pp->pln_own, "\t\t%d%% hitchance...", hitchance);
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "nat.h"
|
||||
#include "news.h"
|
||||
#include "nsc.h"
|
||||
#include "nuke.h"
|
||||
#include "optlist.h"
|
||||
#include "path.h"
|
||||
#include "plane.h"
|
||||
|
@ -129,8 +130,10 @@ msl_hit(struct plnstr *pp, int hardtarget, int type, int news_item,
|
|||
putplane(pp->pln_uid, pp);
|
||||
mpr(pp->pln_own, "\tSHWOOOOOSH! Missile launched!\n");
|
||||
|
||||
if (pp->pln_nuketype != -1)
|
||||
if (nuk_on_plane(pp) >= 0) {
|
||||
mpr(pp->pln_own, "\tArming nuclear warheads...\n");
|
||||
hitchance = 100;
|
||||
}
|
||||
|
||||
if (pcp->pl_flags & P_T)
|
||||
mpr(victim, "Incoming %s missile sighted at %s...\n",
|
||||
|
@ -150,9 +153,6 @@ msl_hit(struct plnstr *pp, int hardtarget, int type, int news_item,
|
|||
}
|
||||
}
|
||||
|
||||
if (pp->pln_nuketype != -1)
|
||||
hitchance = 100;
|
||||
|
||||
mpr(pp->pln_own, "\t%d%% hitchance...", hitchance);
|
||||
hit = (roll(100) <= hitchance);
|
||||
|
||||
|
|
|
@ -666,7 +666,7 @@ pln_equip(struct plist *plp, struct ichrstr *ip, int flags, char mission)
|
|||
switch (mission) {
|
||||
case 's': /* strategic bomb */
|
||||
case 'p': /* pinpoint bomb */
|
||||
if (pp->pln_nuketype == -1) {
|
||||
if (nuk_on_plane(pp) < 0) {
|
||||
itype = I_SHELL;
|
||||
needed = load;
|
||||
}
|
||||
|
@ -1138,7 +1138,6 @@ pln_damage(struct plnstr *pp, coord x, coord y, char type, int *nukedamp,
|
|||
if (getnuke(nuk_on_plane(pp), &nuke)) {
|
||||
mpr(pp->pln_own, "Releasing RV's for %s detonation...\n",
|
||||
pp->pln_flags & PLN_AIRBURST ? "airburst" : "groundburst");
|
||||
pp->pln_nuketype = -1;
|
||||
*nukedamp = detonate(&nuke, x, y,
|
||||
pp->pln_flags & PLN_AIRBURST);
|
||||
return 0;
|
||||
|
|
|
@ -108,6 +108,7 @@ trade_desc(struct trdstr *tp, union empobj_storage *tgp)
|
|||
struct nstr_item ni;
|
||||
struct plnstr plane;
|
||||
struct lndstr land;
|
||||
struct nukstr nuke;
|
||||
|
||||
switch (tp->trd_type) {
|
||||
case EF_NUKE:
|
||||
|
@ -136,9 +137,8 @@ trade_desc(struct trdstr *tp, union empobj_storage *tgp)
|
|||
plane.pln_tech,
|
||||
plane.pln_effic,
|
||||
plchr[(int)plane.pln_type].pl_name, plane.pln_uid);
|
||||
if (plane.pln_nuketype != -1) {
|
||||
pr("(%s)", nchr[(int)plane.pln_nuketype].n_name);
|
||||
}
|
||||
if (getnuke(nuk_on_plane(&plane), &nuke))
|
||||
pr("(%s)", nchr[nuke.nuk_type].n_name);
|
||||
}
|
||||
}
|
||||
snxtitem_all(&ni, EF_LAND);
|
||||
|
@ -157,10 +157,8 @@ trade_desc(struct trdstr *tp, union empobj_storage *tgp)
|
|||
plane.pln_effic,
|
||||
plchr[(int)plane.pln_type].pl_name,
|
||||
plane.pln_uid);
|
||||
if (plane.pln_nuketype != -1) {
|
||||
pr("(%s)",
|
||||
nchr[(int)plane.pln_nuketype].n_name);
|
||||
}
|
||||
if (getnuke(nuk_on_plane(&plane), &nuke))
|
||||
pr("(%s)", nchr[nuke.nuk_type].n_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -193,9 +191,8 @@ trade_desc(struct trdstr *tp, union empobj_storage *tgp)
|
|||
plane.pln_tech,
|
||||
plane.pln_effic,
|
||||
plchr[(int)plane.pln_type].pl_name, plane.pln_uid);
|
||||
if (plane.pln_nuketype != -1) {
|
||||
pr("(%s)", nchr[(int)plane.pln_nuketype].n_name);
|
||||
}
|
||||
if (getnuke(nuk_on_plane(&plane), &nuke))
|
||||
pr("(%s)", nchr[nuke.nuk_type].n_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -209,9 +206,8 @@ trade_desc(struct trdstr *tp, union empobj_storage *tgp)
|
|||
pp->pln_tech,
|
||||
pp->pln_effic,
|
||||
plchr[(int)pp->pln_type].pl_name, tp->trd_unitid);
|
||||
if (pp->pln_nuketype != -1) {
|
||||
pr("(%s)", nchr[(int)pp->pln_nuketype].n_name);
|
||||
}
|
||||
if (getnuke(nuk_on_plane(pp), &nuke))
|
||||
pr("(%s)", nchr[nuke.nuk_type].n_name);
|
||||
break;
|
||||
default:
|
||||
pr("flaky unit type %d", tp->trd_type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue