]> git.pond.sub.org Git - empserver/commitdiff
Nuclear-tipped missile exploding on launch could not damage base
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 13 Mar 2010 12:49:36 +0000 (13:49 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 16 Mar 2010 20:28:08 +0000 (21:28 +0100)
Commit a269cdd7 (v4.3.23) removed the nuclear damage.  But it left the
nuke on the missile, which made pln_damage() oops and return zero
damage.

Fix by destroying the nuke separately.

src/lib/subs/mslsub.c
src/lib/subs/plnsub.c

index 179b35771a2914f98175d419c7d8d77c17ec6ef8..6836be98e2131a742e350583f9974513f8024503 100644 (file)
@@ -59,6 +59,7 @@ msl_launch(struct plnstr *pp, int type, char *what, coord x, coord y,
           natid victim, int *sublaunchp)
 {
     struct shpstr ship;
           natid victim, int *sublaunchp)
 {
     struct shpstr ship;
+    struct nukstr nuke;
     struct sctstr sect;
     int sublaunch = 0;
     char *from;
     struct sctstr sect;
     int sublaunch = 0;
     char *from;
@@ -93,6 +94,11 @@ msl_launch(struct plnstr *pp, int type, char *what, coord x, coord y,
     if (chance((0.05 + (100 - pp->pln_effic) / 100.0)
               * (1 - techfact(pp->pln_tech, 1.0)))) {
        mpr(pp->pln_own, "KABOOOOM!  Missile explodes %s!\n", from);
     if (chance((0.05 + (100 - pp->pln_effic) / 100.0)
               * (1 - techfact(pp->pln_tech, 1.0)))) {
        mpr(pp->pln_own, "KABOOOOM!  Missile explodes %s!\n", from);
+       if (getnuke(nuk_on_plane(pp), &nuke)) {
+           pr("%s lost!\n", prnuke(&nuke));
+           nuke.nuk_effic = 0;
+           putnuke(nuke.nuk_uid, &nuke);
+       }
        if (chance(0.33)) {
            dam = pln_damage(pp, 'p', 0) / 2;
            if (pp->pln_ship >= 0) {
        if (chance(0.33)) {
            dam = pln_damage(pp, 'p', 0) / 2;
            if (pp->pln_ship >= 0) {
index 597443bd837a7e52a150bfe68ed00dccf3cf78a3..5e11ec05e2f3f8c907297a100eac7036e835cc54 100644 (file)
@@ -988,7 +988,7 @@ pln_damage(struct plnstr *pp, char type, int noisy)
     int effective = 1;
     int pinbomber = 0;
 
     int effective = 1;
     int pinbomber = 0;
 
-    if (CANT_HAPPEN(nuk_on_plane(pp) >= 0)) /* FIXME check uses! */
+    if (CANT_HAPPEN(nuk_on_plane(pp) >= 0))
        return 0;
 
     load = pln_load(pp);
        return 0;
 
     load = pln_load(pp);