Fix launch not to wipe out target ship updates
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 26 Dec 2009 10:28:25 +0000 (11:28 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 26 Dec 2009 10:28:25 +0000 (11:28 +0100)
Ships can expend shells to defend against missiles, in
shp_missile_defense().  Any shell use by the target ship got wiped out
when launch_missile() wrote back the target ship, triggering a seqno
mismatch oops.

Fix by re-reading the target ship.

src/lib/commands/laun.c

index 62b3b5b6f229bbdb035405be546cb3b9d9baeec4..932b4bd15b94d3f84ed7879fb5ac4cf2a80fa2e5 100644 (file)
@@ -276,6 +276,7 @@ launch_missile(struct plnstr *pp)
                       target_ship.shp_x, target_ship.shp_y,
                       target_ship.shp_own, &sublaunch) < 0)
            return RET_OK;
+       getship(n, &target_ship);
        if (!msl_hit(pp, shp_hardtarget(&target_ship), EF_SHIP,
                     N_SHP_MISS, N_SHP_SMISS, sublaunch,
                     target_ship.shp_own)) {