Simplify detonate() for nukes falling on water
This commit is contained in:
parent
ea4662061d
commit
b97d0c625e
1 changed files with 2 additions and 27 deletions
|
@ -73,28 +73,23 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
|
||||||
int rad;
|
int rad;
|
||||||
struct nstr_sect ns;
|
struct nstr_sect ns;
|
||||||
struct nstr_item ni;
|
struct nstr_item ni;
|
||||||
int issea;
|
|
||||||
|
|
||||||
mpr(bombown, "Releasing RV's for %s detonation...\n",
|
mpr(bombown, "Releasing RV's for %s detonation...\n",
|
||||||
airburst ? "airburst" : "groundburst");
|
airburst ? "airburst" : "groundburst");
|
||||||
|
|
||||||
getsect(x, y, §);
|
getsect(x, y, §);
|
||||||
issea = sect.sct_type == SCT_WATER;
|
|
||||||
ncp = &nchr[nuketype];
|
ncp = &nchr[nuketype];
|
||||||
kaboom(x, y, ncp->n_blast, bombown);
|
kaboom(x, y, ncp->n_blast, bombown);
|
||||||
rad = ncp->n_blast;
|
rad = ncp->n_blast;
|
||||||
if (!airburst)
|
if (!airburst)
|
||||||
rad = rad * 2 / 3;
|
rad = rad * 2 / 3;
|
||||||
|
if (sect.sct_type == SCT_WATER)
|
||||||
|
rad = 0; /* Nukes falling on water affect only 1 sector */
|
||||||
np->nuk_effic = 0;
|
np->nuk_effic = 0;
|
||||||
putnuke(np->nuk_uid, np);
|
putnuke(np->nuk_uid, np);
|
||||||
|
|
||||||
snxtsct_dist(&ns, x, y, rad);
|
snxtsct_dist(&ns, x, y, rad);
|
||||||
while (nxtsct(&ns, §)) {
|
while (nxtsct(&ns, §)) {
|
||||||
/* Nukes falling on water affect only 1 sector */
|
|
||||||
if ((sect.sct_x != x) && issea)
|
|
||||||
continue;
|
|
||||||
if ((sect.sct_y != y) && issea)
|
|
||||||
continue;
|
|
||||||
own = sect.sct_own;
|
own = sect.sct_own;
|
||||||
type = sect.sct_type;
|
type = sect.sct_type;
|
||||||
if ((damage = nukedamage(ncp, ns.curdist, airburst)) <= 0)
|
if ((damage = nukedamage(ncp, ns.curdist, airburst)) <= 0)
|
||||||
|
@ -146,11 +141,6 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
|
||||||
|
|
||||||
snxtitem_dist(&ni, EF_PLANE, x, y, rad);
|
snxtitem_dist(&ni, EF_PLANE, x, y, rad);
|
||||||
while (nxtitem(&ni, &plane)) {
|
while (nxtitem(&ni, &plane)) {
|
||||||
/* Nukes falling on water affect only 1 sector */
|
|
||||||
if ((plane.pln_x != x) && issea)
|
|
||||||
continue;
|
|
||||||
if ((plane.pln_y != y) && issea)
|
|
||||||
continue;
|
|
||||||
if ((own = plane.pln_own) == 0)
|
if ((own = plane.pln_own) == 0)
|
||||||
continue;
|
continue;
|
||||||
if (plane.pln_flags & PLN_LAUNCHED)
|
if (plane.pln_flags & PLN_LAUNCHED)
|
||||||
|
@ -196,11 +186,6 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
|
||||||
|
|
||||||
snxtitem_dist(&ni, EF_LAND, x, y, rad);
|
snxtitem_dist(&ni, EF_LAND, x, y, rad);
|
||||||
while (nxtitem(&ni, &land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
/* Nukes falling on water affect only 1 sector */
|
|
||||||
if ((land.lnd_x != x) && issea)
|
|
||||||
continue;
|
|
||||||
if ((land.lnd_y != y) && issea)
|
|
||||||
continue;
|
|
||||||
if ((own = land.lnd_own) == 0)
|
if ((own = land.lnd_own) == 0)
|
||||||
continue;
|
continue;
|
||||||
if ((damage = nukedamage(ncp, ni.curdist, airburst)) <= 0)
|
if ((damage = nukedamage(ncp, ni.curdist, airburst)) <= 0)
|
||||||
|
@ -243,11 +228,6 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
|
||||||
|
|
||||||
snxtitem_dist(&ni, EF_SHIP, x, y, rad);
|
snxtitem_dist(&ni, EF_SHIP, x, y, rad);
|
||||||
while (nxtitem(&ni, &ship)) {
|
while (nxtitem(&ni, &ship)) {
|
||||||
/* Nukes falling on water affect only 1 sector */
|
|
||||||
if ((ship.shp_x != x) && issea)
|
|
||||||
continue;
|
|
||||||
if ((ship.shp_y != y) && issea)
|
|
||||||
continue;
|
|
||||||
if ((own = ship.shp_own) == 0)
|
if ((own = ship.shp_own) == 0)
|
||||||
continue;
|
continue;
|
||||||
if ((damage = nukedamage(ncp, ni.curdist, airburst)) <= 0)
|
if ((damage = nukedamage(ncp, ni.curdist, airburst)) <= 0)
|
||||||
|
@ -284,11 +264,6 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
|
||||||
|
|
||||||
snxtitem_dist(&ni, EF_NUKE, x, y, rad);
|
snxtitem_dist(&ni, EF_NUKE, x, y, rad);
|
||||||
while (nxtitem(&ni, &nuke)) {
|
while (nxtitem(&ni, &nuke)) {
|
||||||
/* Nukes falling on water affect only 1 sector */
|
|
||||||
if ((nuke.nuk_x != x) && issea)
|
|
||||||
continue;
|
|
||||||
if ((nuke.nuk_y != y) && issea)
|
|
||||||
continue;
|
|
||||||
if ((own = nuke.nuk_own) == 0)
|
if ((own = nuke.nuk_own) == 0)
|
||||||
continue;
|
continue;
|
||||||
if ((damage = nukedamage(ncp, ni.curdist, airburst)) <= 0)
|
if ((damage = nukedamage(ncp, ni.curdist, airburst)) <= 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue