From e0cb1b66b38c8da75b3b78ad0c57de3c893ddb88 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 7 Sep 2009 15:20:41 -0400 Subject: [PATCH] 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. --- src/lib/subs/detonate.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lib/subs/detonate.c b/src/lib/subs/detonate.c index c425f75d..68b348d1 100644 --- a/src/lib/subs/detonate.c +++ b/src/lib/subs/detonate.c @@ -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, §); 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(§, 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); }