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:
parent
8718a9428a
commit
e0cb1b66b3
1 changed files with 1 additions and 4 deletions
|
@ -73,7 +73,6 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
|
||||||
struct nstr_sect ns;
|
struct nstr_sect ns;
|
||||||
struct nstr_item ni;
|
struct nstr_item ni;
|
||||||
int issea;
|
int issea;
|
||||||
int retval;
|
|
||||||
|
|
||||||
getsect(x, y, §);
|
getsect(x, y, §);
|
||||||
issea = sect.sct_type == SCT_WATER;
|
issea = sect.sct_type == SCT_WATER;
|
||||||
|
@ -106,8 +105,6 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
|
||||||
if (opt_FALLOUT)
|
if (opt_FALLOUT)
|
||||||
fallout = sect.sct_fallout;
|
fallout = sect.sct_fallout;
|
||||||
sect_damage(§, damage);
|
sect_damage(§, damage);
|
||||||
if (sect.sct_x == x && sect.sct_y == y)
|
|
||||||
retval = damage;
|
|
||||||
if (opt_FALLOUT) {
|
if (opt_FALLOUT) {
|
||||||
if (ncp->n_flags & N_NEUT)
|
if (ncp->n_flags & N_NEUT)
|
||||||
fallout += damage * 30;
|
fallout += damage * 30;
|
||||||
|
@ -306,7 +303,7 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
|
||||||
putnuke(ni.cur, &nuke);
|
putnuke(ni.cur, &nuke);
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return nukedamage(ncp, 0, airburst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue