]> git.pond.sub.org Git - empserver/commitdiff
Fix value of detonate() when target sector takes no damage
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 7 Sep 2009 19:20:41 +0000 (15:20 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 8 Dec 2009 07:15:50 +0000 (08:15 +0100)
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

index c425f75d11605bdd1516c13b728724be9242d8af..68b348d18fb4fffae954bb5480872dee473d4829 100644 (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);
 }