Disable damage to base when missile explodes on launch

When a missile explodes on launch, it has a 33% chance to damage its
base.

Unfortunately, damaging the base breaks callers that call msl_launch()
for each member of a list of missiles created by msl_sel() or
perform_mission().  Damage to the base can damage other missiles
there.  Any copies of them in the list become stale.  When
msl_launch() modifies and writes back such a stale copy, the damage
gets wiped out, triggering a seqno oops.

Affects missile interdiction and interception using missiles with
non-zero load.  Stock game's ABMs have zero load, so interception is
safe there.  Relatively harmless in practice.  Broken in Empire 2.

Instead of fixing the bug, simply disable damage to the base for now.
This commit is contained in:
Markus Armbruster 2012-05-22 20:17:16 +02:00
parent 0dd59211aa
commit ea94ec2f18

View file

@ -55,10 +55,8 @@ msl_launch(struct plnstr *pp, int type, char *what, coord x, coord y,
{ {
struct shpstr ship; struct shpstr ship;
struct nukstr nuke; struct nukstr nuke;
struct sctstr sect;
int sublaunch = 0; int sublaunch = 0;
char *base, *in_or_at, *from; char *base, *in_or_at, *from;
int dam;
mpr(pp->pln_own, "Preparing to launch %s at %s %s %s%s\n", mpr(pp->pln_own, "Preparing to launch %s at %s %s %s%s\n",
prplane(pp), prplane(pp),
@ -100,7 +98,20 @@ msl_launch(struct plnstr *pp, int type, char *what, coord x, coord y,
nuke.nuk_effic = 0; nuke.nuk_effic = 0;
putnuke(nuke.nuk_uid, &nuke); putnuke(nuke.nuk_uid, &nuke);
} }
#if 0
/*
* Disabled for now, because it breaks callers that call
* msl_launch() for each member of a list of planes, created
* by msl_sel() or perform_mission(). Damage to the base can
* damage other planes. Any copies of them in the list become
* stale. When msl_launch() modifies and writes back such a
* stale copy, the damage gets wiped out, triggering a seqno
* oops.
*/
if (chance(0.33)) { if (chance(0.33)) {
struct sctstr sect;
int dam;
dam = pln_damage(pp, 'p', 0) / 2; dam = pln_damage(pp, 'p', 0) / 2;
if (pp->pln_ship >= 0) { if (pp->pln_ship >= 0) {
shipdamage(&ship, dam); shipdamage(&ship, dam);
@ -113,6 +124,7 @@ msl_launch(struct plnstr *pp, int type, char *what, coord x, coord y,
putsect(&sect); putsect(&sect);
} }
} }
#endif
return -1; return -1;
} }