/*
* 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
return value;
}
+int
+lnd_reaction_range(struct lndstr *lp)
+{
+ struct sctstr sect;
+
+ getsect(lp->lnd_x, lp->lnd_y, §);
+ if (sect.sct_type == SCT_HEADQ && sect.sct_effic >= 60)
+ return lchr[lp->lnd_type].l_rad + 1;
+ return lchr[lp->lnd_type].l_rad;
+}
+
void
lnd_print(struct ulist *llp, char *s)
{
prland(&llp->unit.land));
continue;
}
- if (sect.sct_type == SCT_BSPAN) {
+ if (SCT_MINES_ARE_SEAMINES(§)) {
if (verbose)
- mpr(actor, "%s is on a bridge. No mines there!\n",
- prland(&llp->unit.land));
+ mpr(actor, "%s is in a %s sector. No landmines there!\n",
+ prland(&llp->unit.land), dchr[sect.sct_type].d_name);
continue;
}
if (takemob) {
getsect(llp->unit.land.lnd_x, llp->unit.land.lnd_y, §);
if (sect.sct_oldown == llp->unit.land.lnd_own)
continue;
- if (sect.sct_type == SCT_BSPAN)
- continue;
- if (!sect.sct_mines)
+ if (SCT_LANDMINES(§) == 0)
continue;
if (chance(DMINE_LHITCHANCE(sect.sct_mines) / (1 + 2 * with_eng))) {
lnd_hit_mine(&llp->unit.land, ((struct lchrstr *)llp->chrp));
lnd_missile_interdiction(struct emp_qelem *list, coord newx, coord newy,
natid victim)
{
- int dam;
+ int mindam = lnd_count(list) * 20;
+ int hardtarget = lnd_easiest_target(list);
+ int dam, newdam;
+ struct plist *plp;
struct emp_qelem msl_list, *qp, *newqp;
msl_sel(&msl_list, newx, newy, victim, P_T, P_MAR, MI_INTERDICT);
- dam = msl_launch_mindam(&msl_list, newx, newy,
- lnd_easiest_target(list), EF_LAND,
- lnd_count(list) * 20, "troops", victim,
- MI_INTERDICT);
+ dam = 0;
+ for (qp = msl_list.q_back; qp != &msl_list; qp = newqp) {
+ newqp = qp->q_back;
+ plp = (struct plist *)qp;
+
+ if (dam < mindam && mission_pln_equip(plp, NULL, 'p') >= 0) {
+ if (msl_hit(&plp->plane, hardtarget, EF_LAND,
+ N_LND_MISS, N_LND_SMISS,
+ "troops", newx, newy, 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(newx, newy, newdam);
+#endif
+ }
+ plp->plane.pln_effic = 0;
+ putplane(plp->plane.pln_uid, &plp->plane);
+ }
+ emp_remque(qp);
+ free(qp);
+ }
+
if (dam) {
mpr(victim, "missile interdiction mission does %d damage!\n", dam);
collateral_damage(newx, newy, dam);
}
- qp = msl_list.q_forw;
- while (qp != msl_list.q_forw) {
- newqp = qp->q_forw;
- emp_remque(qp);
- free(qp);
- qp = newqp;
- }
return dam;
}
pr("%s was shot and killed.\n", prland(&llp->unit.land));
llp->unit.land.lnd_effic = 0;
putland(llp->unit.land.lnd_uid, &llp->unit.land);
- lnd_delete(llp, 0);
+ lnd_delete(llp, NULL);
}
}
}