/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
* ---
*
* mslsub.c: Missile subroutine stuff
- *
+ *
* Known contributors to this file:
* Ken Stevens, 1995
* Steve McClure, 1996-2000
#include "nat.h"
#include "news.h"
#include "nsc.h"
+#include "nuke.h"
#include "optlist.h"
#include "path.h"
#include "plane.h"
return 0;
}
+ 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 (pp->pln_nuketype != -1)
+ if (nuk_on_plane(pp) >= 0) {
mpr(pp->pln_own, "\tArming nuclear warheads...\n");
+ hitchance = 100;
+ }
if (pcp->pl_flags & P_T)
mpr(victim, "Incoming %s missile sighted at %s...\n",
}
}
- if (pp->pln_nuketype != -1)
- hitchance = 100;
-
mpr(pp->pln_own, "\t%d%% hitchance...", hitchance);
hit = (roll(100) <= hitchance);
continue;
if (mission && plane.pln_mission != mission)
continue;
+ if (mission &&
+ plane.pln_radius < mapdist(x, y, plane.pln_opx, plane.pln_opy))
+ continue;
if (getrel(getnatp(plane.pln_own), victim) >= NEUTRAL)
continue;
/* missiles go one way, so we can use all the range */
dam += nukedam;
} else
dam += newdam;
+#if 0
+ /*
+ * FIXME want collateral damage on miss (which can't
+ * happen for nuclear war heads), but we get here too when
+ * launch fails or missile is intercepted
+ */
} else {
/* Missiles that miss have to hit somewhere! */
newdam = pln_damage(&plp->plane, x, y, 'p', &nukedam, 0);
collateral_damage(x, y, newdam);
+#endif
}
plp->plane.pln_effic = 0;
putplane(plp->plane.pln_uid, &plp->plane);