Fix value of detonate() when target sector takes no damage

This can happen when hitting a sanctuary, or for ridiculously impotent
nukes: groundburst for dam < 5, airburst for dam < 7.  detonate()
returned unpredictable value then.

This screwed up interdiction damage, except for missiles interdicting
ships or land units.  Since nothing can move into a sanctuary, the bug
bit only with ridiculously impotent nukes.
This commit is contained in:
Markus Armbruster 2009-09-07 15:20:41 -04:00
parent 8718a9428a
commit e0cb1b66b3

View file

@ -73,7 +73,6 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
struct nstr_sect ns;
struct nstr_item ni;
int issea;
int retval;
getsect(x, y, &sect);
issea = sect.sct_type == SCT_WATER;
@ -106,8 +105,6 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
if (opt_FALLOUT)
fallout = sect.sct_fallout;
sect_damage(&sect, damage);
if (sect.sct_x == x && sect.sct_y == y)
retval = damage;
if (opt_FALLOUT) {
if (ncp->n_flags & N_NEUT)
fallout += damage * 30;
@ -306,7 +303,7 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
putnuke(ni.cur, &nuke);
}
return retval;
return nukedamage(ncp, 0, airburst);
}