]> git.pond.sub.org Git - empserver/commitdiff
Fix harmless seqno mismatch in launch
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 18 Apr 2010 17:05:52 +0000 (19:05 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 9 May 2010 07:08:03 +0000 (09:08 +0200)
When an inefficient missile exploded on launch, it could damage
itself.  The damage had no effect, because the missile gets used up
right after.  But it triggers a seqno mismatch oops, in laun().  Fix
by making msl_launch() set PLN_LAUNCHED before the explosion.

This case was missed in commit 7bc63871, v4.3.14.  It didn't oops
until sequence numbers were added in v4.3.15.

src/lib/subs/mslsub.c

index 6836be98e2131a742e350583f9974513f8024503..0b9f6cb35960117ce01cf9bcc302807431b401df 100644 (file)
@@ -91,6 +91,10 @@ msl_launch(struct plnstr *pp, int type, char *what, coord x, coord y,
        mpr(pp->pln_own, "%s\n", xyas(pp->pln_x, pp->pln_y, pp->pln_own));
     }
 
+    CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED);
+    pp->pln_flags |= PLN_LAUNCHED;
+    putplane(pp->pln_uid, pp);
+
     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);
@@ -115,9 +119,6 @@ msl_launch(struct plnstr *pp, int type, char *what, coord x, coord y,
        return -1;
     }
 
-    CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED);
-    pp->pln_flags |= PLN_LAUNCHED;
-    putplane(pp->pln_uid, pp);
     mpr(pp->pln_own, "\tSHWOOOOOSH!  Missile launched!\n");
 
     if (type != EF_PLANE)