/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
taken = llp->unit.land.lnd_item[I_MILIT];
/* Spies always die */
- if (((struct lchrstr *)llp->chrp)->l_flags & L_SPY) {
- eff_eq = 100;
+ if (((struct lchrstr *)llp->chrp)->l_flags & L_SPY)
llp->unit.land.lnd_effic = 0;
- } else {
+ else {
eff_eq = ldround(cas * 100.0 /
((struct lchrstr *)llp->chrp)->l_item[I_MILIT], 1);
llp->unit.land.lnd_effic -= eff_eq;
for (qp = list->q_back; qp != list; qp = next) {
next = qp->q_back;
llp = (struct ulist *)qp;
- /* have to get it again because of collateral damage */
+ /* land unit might have changed (launched SAMs, collateral dmg) */
getland(llp->unit.land.lnd_uid, &llp->unit.land);
landdamage(&llp->unit.land, dam);
putland(llp->unit.land.lnd_uid, &llp->unit.land);
int mindam = lnd_count(list) * 20;
int hardtarget = lnd_easiest_target(list);
int dam, newdam, sublaunch;
+ int stopping = 0;
struct plist *plp;
struct emp_qelem msl_list, *qp, *newqp;
if (msl_launch(&plp->plane, EF_LAND, "troops",
newx, newy, victim, &sublaunch) < 0)
goto use_up_msl;
+ stopping = 1;
if (msl_hit(&plp->plane, hardtarget, EF_LAND,
N_LND_MISS, N_LND_SMISS, sublaunch, victim)) {
newdam = pln_damage(&plp->plane, 'p', 1);
if (dam) {
mpr(victim, "missile interdiction mission does %d damage!\n", dam);
collateral_damage(newx, newy, dam);
+ lnd_damage(list, dam);
}
- return lnd_damage(list, dam);
+ return stopping;
}
#if 0
double guneff;
int shell, gun;
int dam;
+ int stopping = 0;
int totdam = 0;
int i;
putsect(&fsect);
if (dam < 0)
continue;
+ stopping = 1;
totdam += dam;
mpr(victim, "Incoming fire does %d damage!\n", dam);
wu(0, fsect.sct_own,
nreport(fsect.sct_own, N_SCT_SHELL, victim, 1);
}
if (totdam > 0)
- return lnd_damage(list, totdam);
- return 0;
+ lnd_damage(list, totdam);
+ return stopping;
}
#endif
lnd_mission_interdiction(struct emp_qelem *list, coord x, coord y,
natid victim)
{
- return lnd_damage(list,
- unit_interdict(x, y, victim, "land units",
- lnd_easiest_target(list),
- MI_INTERDICT));
+ int dam;
+
+ dam = unit_interdict(x, y, victim, "land units",
+ lnd_easiest_target(list),
+ MI_INTERDICT);
+ if (dam >= 0)
+ lnd_damage(list, dam);
+ return dam >= 0;
}
int
nreport(lp->lnd_own, N_LHIT_MINE, 0, 1);
m = MINE_LDAMAGE();
- if (lchr[lp->lnd_uid].l_flags & L_ENGINEER)
+ if (lchr[lp->lnd_type].l_flags & L_ENGINEER)
m /= 2;
landdamage(lp, m);
/* move survivors to done */
for (qp = cur.q_back; qp != &cur; qp = next) {
next = qp->q_back;
- llp = (struct ulist *)qp;
emp_remque(qp);
emp_insque(qp, &done);
}