]> git.pond.sub.org Git - empserver/commitdiff
Enable the new nuk_on_plane(), replacing the old one
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 6 Sep 2008 23:22:56 +0000 (19:22 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 9 Sep 2008 01:32:52 +0000 (21:32 -0400)
Callers changed, as the new one isn't a drop-in replacements.

include/nuke.h
include/prototypes.h
src/lib/commands/arm.c
src/lib/common/cargo.c
src/lib/subs/nuke.c
src/lib/subs/plnsub.c

index 05245cfb4b2a1ea555ba265df72f607f3a53432d..ef176d4b8854a46fc076749a01c0f600ae68e2a7 100644 (file)
@@ -92,8 +92,6 @@ extern struct nchrstr nchr[N_MAXNUKE + 1];
 
 /* 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 *);
-#endif
 
 #endif
 
 #endif
index 7cb9bd305de289eeef663d0ede3547d2c5012983..be5b01a4d2c4484015ba1ec35ea459a382c3e0a6 100644 (file)
@@ -521,7 +521,6 @@ extern char *prnuke(struct nukstr *);
 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 */
index 5a9109c58e153ae975d0254d0cc846da970635fc..8a443caa7f926180edf49530415934e4c5147882 100644 (file)
@@ -73,7 +73,7 @@ arm(void)
                return RET_FAIL;
            }
        }
                return RET_FAIL;
            }
        }
-       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)
@@ -83,11 +83,6 @@ arm(void)
            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) {
@@ -143,7 +138,7 @@ disarm(void)
     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)) {
@@ -152,10 +147,6 @@ disarm(void)
                return RET_FAIL;
            }
        }
                return RET_FAIL;
            }
        }
-       if (nuk_on_plane(&nuke, pl.pln_uid) < 0) {
-           CANT_REACH();
-           continue;
-       }
        getsect(nuke.nuk_x, nuke.nuk_y, &sect);
        if (!player->owner
            && getrel(getnatp(sect.sct_own), player->cnum) != ALLIED) {
        getsect(nuke.nuk_x, nuke.nuk_y, &sect);
        if (!player->owner
            && getrel(getnatp(sect.sct_own), player->cnum) != ALLIED) {
index 4e38b3b0b8d851d31cc171d416eebc31711211d5..64f904c267a78c5fe71cbd583abf84fdfa00777e 100644 (file)
@@ -379,7 +379,6 @@ lnd_next_on_unit(int uid)
     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.
  */
@@ -388,4 +387,3 @@ nuk_on_plane(struct plnstr *pp)
 {
     return unit_cargo_first(EF_PLANE, pp->pln_uid, EF_NUKE);
 }
 {
     return unit_cargo_first(EF_PLANE, pp->pln_uid, EF_NUKE);
 }
-#endif
index 0708ff579afeaf3df9ebf464a4629926df35c168..3477d6debb4e10105c4a6457e22a497e3348fe94 100644 (file)
@@ -94,21 +94,6 @@ nuk_prewrite(int n, void *old, void *new)
     np->nuk_own = own;
 }
 
     np->nuk_own = own;
 }
 
-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)
 {
index bb582a277373aaf3f9b1894d5a4855a22841434f..d4a9564832825b5dea04b787547058eaf9d363a8 100644 (file)
@@ -1135,16 +1135,13 @@ pln_damage(struct plnstr *pp, coord x, coord y, char type, int *nukedamp,
     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;
     }
     *nukedamp = 0;
 
     }
     *nukedamp = 0;