From 25083649454dfa85afd14ab1867ad699d1eac92b Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 24 May 2005 18:38:36 +0000 Subject: [PATCH] (lnd_support): New parameter defending, to report defensive support in the news correctly, like dd() and sd() do. Reported by Doug Wescott. --- include/land.h | 2 +- src/lib/subs/attsub.c | 4 ++-- src/lib/subs/lndsub.c | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/land.h b/include/land.h index ebd4eba88..1ed6f3dc1 100644 --- a/include/land.h +++ b/include/land.h @@ -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); diff --git a/src/lib/subs/attsub.c b/src/lib/subs/attsub.c index 854309e05..f69581e09 100644 --- a/src/lib/subs/attsub.c +++ b/src/lib/subs/attsub.c @@ -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); diff --git a/src/lib/subs/lndsub.c b/src/lib/subs/lndsub.c index ca38715bb..979cf0fa7 100644 --- a/src/lib/subs/lndsub.c +++ b/src/lib/subs/lndsub.c @@ -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; -- 2.43.0