(lnd_support): New parameter defending, to report defensive support in

the news correctly, like dd() and sd() do.  Reported by Doug Wescott.
This commit is contained in:
Markus Armbruster 2005-05-24 18:38:36 +00:00
parent 82ac1a9ddc
commit 2508364945
3 changed files with 8 additions and 5 deletions

View file

@ -226,7 +226,7 @@ extern int lnd_hit_mine(struct lndstr *, struct lchrstr *);
extern void lnd_list(struct emp_qelem *);
extern int lnd_hardtarget(struct lndstr *);
extern int lnd_mar_one_sector(struct emp_qelem *, int, natid, int);
extern int lnd_support(natid, natid, coord, coord);
extern int lnd_support(natid, natid, coord, coord, int);
extern int lnd_can_attack(struct lndstr *);
extern int lnd_fortify (struct lndstr *lp, int hard_amt);
extern void lnd_set_tech(struct lndstr *, int);

View file

@ -1654,7 +1654,7 @@ get_osupport(s_char *outs, struct combat *def, int fort_sup, int ship_sup,
}
if (land_sup) {
dam = lnd_support(def->own, player->cnum, def->x, def->y);
dam = lnd_support(def->own, player->cnum, def->x, def->y, 0);
au = ((double)dam / 100.0);
osupport += au;
}
@ -1698,7 +1698,7 @@ get_dsupport(s_char *outs, struct emp_qelem *list, struct combat *def,
dtotal = get_dtotal(def, list, dsupport, 0);
}
if (dtotal < 1.2 * ototal) {
dam = lnd_support(player->cnum, def->own, def->x, def->y);
dam = lnd_support(player->cnum, def->own, def->x, def->y, 1);
du = ((double)dam / 100.0);
dsupport += du;
dtotal = get_dtotal(def, list, dsupport, 1);

View file

@ -1242,7 +1242,7 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
*
*/
int
lnd_support(natid victim, natid attacker, coord x, coord y)
lnd_support(natid victim, natid attacker, coord x, coord y, int defending)
{
struct nstr_item ni;
struct lndstr land;
@ -1296,7 +1296,10 @@ lnd_support(natid victim, natid attacker, coord x, coord y)
continue;
use_supply(&land);
nreport(land.lnd_own, N_FIRE_L_ATTACK, victim, 1);
if (defending)
nreport(land.lnd_own, N_FIRE_BACK, victim, 1);
else
nreport(land.lnd_own, N_FIRE_L_ATTACK, victim, 1);
if (roll(100) < land.lnd_acc) {
dam += landunitgun(land.lnd_effic, land.lnd_dam, gun,
land.lnd_ammo, shell) / 2;