Callers changed, as the new one isn't a drop-in replacements.
/* src/lib/common/cargo.c */
extern void nuk_carrier_change(struct nukstr *, int, int, int);
/* src/lib/common/cargo.c */
extern void nuk_carrier_change(struct nukstr *, int, int, int);
-#if 0 /* clashes with the one in src/lib/subs/nuke.c */
extern int nuk_on_plane(struct plnstr *);
extern int nuk_on_plane(struct plnstr *);
extern void nuk_oninit(void *);
extern void nuk_postread(int, void *);
extern void nuk_prewrite(int, void *, void *);
extern void nuk_oninit(void *);
extern void nuk_postread(int, void *);
extern void nuk_prewrite(int, void *, void *);
-extern int nuk_on_plane(struct nukstr *, int);
/* nxtitem.c */
extern int nxtitem(struct nstr_item *, void *);
/* nxtsct.c */
/* nxtitem.c */
extern int nxtitem(struct nstr_item *, void *);
/* nxtsct.c */
- if (pl.pln_nuketype < 0) {
+ if (!getnuke(nuk_on_plane(&pl), &nuke)) {
sprintf(prompt, "Nuclear device for %s: ", prplane(&pl));
p = getstarg(player->argp[2], prompt, buf);
if (!p || !*p)
sprintf(prompt, "Nuclear device for %s: ", prplane(&pl));
p = getstarg(player->argp[2], prompt, buf);
if (!p || !*p)
nukno = atoi(p);
if (!getnuke(nukno, &nuke) || !player->owner)
return RET_FAIL;
nukno = atoi(p);
if (!getnuke(nukno, &nuke) || !player->owner)
return RET_FAIL;
- } else {
- if (nuk_on_plane(&nuke, pl.pln_uid) < 0) {
- CANT_REACH();
- continue;
- }
}
ncp = &nchr[nuke.nuk_type];
if (pln_load(&pl) < ncp->n_weight) {
}
ncp = &nchr[nuke.nuk_type];
if (pln_load(&pl) < ncp->n_weight) {
while (nxtitem(&ni, &pl)) {
if (!player->owner)
continue;
while (nxtitem(&ni, &pl)) {
if (!player->owner)
continue;
- if (pl.pln_nuketype == -1)
+ if (!getnuke(nuk_on_plane(&pl), &nuke))
continue;
if (opt_MARKET) {
if (ontradingblock(EF_PLANE, &pl)) {
continue;
if (opt_MARKET) {
if (ontradingblock(EF_PLANE, &pl)) {
- if (nuk_on_plane(&nuke, pl.pln_uid) < 0) {
- CANT_REACH();
- continue;
- }
getsect(nuke.nuk_x, nuke.nuk_y, §);
if (!player->owner
&& getrel(getnatp(sect.sct_own), player->cnum) != ALLIED) {
getsect(nuke.nuk_x, nuke.nuk_y, §);
if (!player->owner
&& getrel(getnatp(sect.sct_own), player->cnum) != ALLIED) {
return unit_cargo_next(EF_LAND, uid);
}
return unit_cargo_next(EF_LAND, uid);
}
-#if 0 /* clashes with the one in src/lib/subs/nuke.c */
/*
* If PP carries a nuke, return its uid, else -1.
*/
/*
* If PP carries a nuke, return its uid, else -1.
*/
{
return unit_cargo_first(EF_PLANE, pp->pln_uid, EF_NUKE);
}
{
return unit_cargo_first(EF_PLANE, pp->pln_uid, EF_NUKE);
}
-int
-nuk_on_plane(struct nukstr *np, int pluid)
-{
- struct nstr_item ni;
-
- snxtitem_all(&ni, EF_NUKE);
- while (nxtitem(&ni, np)) {
- if (np->nuk_own == 0)
- continue;
- if (np->nuk_plane == pluid)
- return np->nuk_uid;
- }
- return -1;
-}
-
void
nuk_oninit(void *ptr)
{
void
nuk_oninit(void *ptr)
{
int effective = 1;
int pinbomber = 0;
int effective = 1;
int pinbomber = 0;
- if (pp->pln_nuketype != -1) {
- if (nuk_on_plane(&nuke, pp->pln_uid) >= 0) {
- 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;
- }
- CANT_REACH();
+ 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;