struct emp_qelem *next;
struct plist *ip;
int icount = 0;
- short destroyed = 0;
+ short destroyed;
char *att_name;
char *def_name;
int news_item;
}
if (icount == 0) {
mpr(sect.sct_own, "No %ss launched to intercept.\n", def_name);
- return destroyed;
+ return 0;
}
/* attempt to destroy incoming missile */
- while (!QEMPTY(intlist)) {
+ destroyed = 0;
+ while (!destroyed && !QEMPTY(intlist)) {
qp = intlist->q_forw;
ip = (struct plist *)qp;
pp = &ip->plane;
def_name, who, att_name, cname(sect.sct_own));
}
- if (!destroyed &&
- msl_hit(pp, hardtarget, EF_PLANE, news_item, news_item,
+ if (msl_hit(pp, hardtarget, EF_PLANE, news_item, news_item,
att_name, x, y, bombown)) {
mpr(bombown, "%s destroyed by %s %s!\n",
att_name, cname(pp->pln_own), def_name);
putplane(pp->pln_uid, pp);
emp_remque(qp);
free(qp);
- if (destroyed)
- break;
}
/* Clean out what is left in the list */
while (!QEMPTY(intlist)) {
free(qp);
}
if (destroyed)
- return destroyed;
+ return 1;
if (icount) {
mpr(bombown, "%s made it through %s defenses!\n",
att_name, def_name);
mpr(sect.sct_own, "%s made it through %s defenses!\n",
att_name, def_name);
}
- return destroyed;
-}
-
-/* Keep launching missiles on list until mindam damage has been done */
-int
-msl_launch_mindam(struct emp_qelem *list, coord x, coord y, int hardtarget,
- int type, int mindam, char *whatp, int victim)
-{
- struct emp_qelem *qp;
- struct emp_qelem *next;
- struct plist *plp;
- int newdam, dam = 0;
- int news_item;
- int snews_item;
-
- if (type == EF_SHIP) {
- news_item = N_SHP_MISS;
- snews_item = N_SHP_SMISS;
- } else if (type == EF_LAND) {
- news_item = N_LND_MISS;
- snews_item = N_LND_SMISS;
- } else {
- news_item = N_SCT_MISS;
- snews_item = N_SCT_SMISS;
- }
-
- for (qp = list->q_back; qp != list && dam < mindam;
- qp = next) {
- next = qp->q_back;
- plp = (struct plist *)qp;
-
- if (mission_pln_equip(plp, NULL, 'p') >= 0) {
- if (msl_hit(&plp->plane,
- hardtarget, type, news_item, snews_item,
- whatp, x, y, victim)) {
- newdam = pln_damage(&plp->plane, 'p', 1);
- dam += newdam;
-#if 0
- /*
- * FIXME want collateral damage on miss, 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, 'p', 0);
- collateral_damage(x, y, newdam);
-#endif
- }
- plp->plane.pln_effic = 0;
- putplane(plp->plane.pln_uid, &plp->plane);
- emp_remque(qp);
- free(qp);
- }
- }
- return dam;
+ return 0;
}