Simplify how fire command passes defender to defend()
Pass defender country number instead of target type, sector (used if target type is targ_land), and ship (used otherwise).
This commit is contained in:
parent
4babf726f0
commit
7b2574c167
1 changed files with 7 additions and 14 deletions
|
@ -54,11 +54,9 @@ struct flist {
|
||||||
static void add_to_fired_queue(struct emp_qelem *, struct emp_qelem *);
|
static void add_to_fired_queue(struct emp_qelem *, struct emp_qelem *);
|
||||||
static int defend(struct emp_qelem *al,
|
static int defend(struct emp_qelem *al,
|
||||||
struct emp_qelem *dl,
|
struct emp_qelem *dl,
|
||||||
enum targ_type target,
|
natid,
|
||||||
enum targ_type attacker,
|
enum targ_type attacker,
|
||||||
struct sctstr *vsect,
|
|
||||||
struct sctstr *fsect,
|
struct sctstr *fsect,
|
||||||
struct shpstr *vship,
|
|
||||||
struct shpstr *fship, int fx, int fy, int *nd);
|
struct shpstr *fship, int fx, int fy, int *nd);
|
||||||
static void do_defdam(struct emp_qelem *, double);
|
static void do_defdam(struct emp_qelem *, double);
|
||||||
static int quiet_bigdef(int, struct emp_qelem *, natid, natid, coord,
|
static int quiet_bigdef(int, struct emp_qelem *, natid, natid, coord,
|
||||||
|
@ -557,8 +555,8 @@ multifire(void)
|
||||||
getsect(fland.lnd_x, fland.lnd_y, &fsect);
|
getsect(fland.lnd_x, fland.lnd_y, &fsect);
|
||||||
}
|
}
|
||||||
totaldefdam =
|
totaldefdam =
|
||||||
defend(&fired, &defended, target, attacker, &vsect, &fsect,
|
defend(&fired, &defended, vict, attacker,
|
||||||
&vship, &fship, fx, fy, &ndefending);
|
&fsect, &fship, fx, fy, &ndefending);
|
||||||
switch (target) {
|
switch (target) {
|
||||||
case targ_land:
|
case targ_land:
|
||||||
putsect(&vsect);
|
putsect(&vsect);
|
||||||
|
@ -595,13 +593,13 @@ multifire(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
defend(struct emp_qelem *al, struct emp_qelem *dl, enum targ_type target,
|
defend(struct emp_qelem *al, struct emp_qelem *dl, natid vict,
|
||||||
enum targ_type attacker, struct sctstr *vsect, struct sctstr *fsect,
|
enum targ_type attacker, struct sctstr *fsect,
|
||||||
struct shpstr *vship, struct shpstr *fship, int fx, int fy, int *nd)
|
struct shpstr *fship, int fx, int fy, int *nd)
|
||||||
{
|
{
|
||||||
|
|
||||||
int dam;
|
int dam;
|
||||||
int vict, nfiring = 0;
|
int nfiring = 0;
|
||||||
struct flist *fp;
|
struct flist *fp;
|
||||||
int aown;
|
int aown;
|
||||||
|
|
||||||
|
@ -610,11 +608,6 @@ defend(struct emp_qelem *al, struct emp_qelem *dl, enum targ_type target,
|
||||||
else
|
else
|
||||||
aown = fship->shp_own;
|
aown = fship->shp_own;
|
||||||
|
|
||||||
if (target == targ_land)
|
|
||||||
vict = vsect->sct_own;
|
|
||||||
else
|
|
||||||
vict = vship->shp_own;
|
|
||||||
|
|
||||||
if (0 !=
|
if (0 !=
|
||||||
(dam = quiet_bigdef(attacker, dl, vict, aown, fx, fy, &nfiring))) {
|
(dam = quiet_bigdef(attacker, dl, vict, aown, fx, fy, &nfiring))) {
|
||||||
if (nfiring > *nd)
|
if (nfiring > *nd)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue