(mission_pln_wanted): Broken like its cousin pln_wanted() was, only
more so: additionally, any of P_E, P_K, P_L satisfied any subset of P_E, P_K, P_L. Chainsaw fixed this one in plnsub.c, but not here. Remove, use the fixed pln_wanted() instead. (pln_wanted): External linkage.
This commit is contained in:
parent
684bac5b1d
commit
98105c9561
3 changed files with 3 additions and 63 deletions
|
@ -556,6 +556,7 @@ extern int put_plane_on_ship(struct plnstr *, struct shpstr *);
|
||||||
extern void pln_dropoff(struct emp_qelem *, struct ichrstr *,
|
extern void pln_dropoff(struct emp_qelem *, struct ichrstr *,
|
||||||
coord, coord, void *, int);
|
coord, coord, void *, int);
|
||||||
extern void pln_mine(struct emp_qelem *list, struct sctstr *sectp);
|
extern void pln_mine(struct emp_qelem *list, struct sctstr *sectp);
|
||||||
|
extern int pln_wanted(struct plnstr *, int, int);
|
||||||
extern void pln_sel(struct nstr_item *, struct emp_qelem *,
|
extern void pln_sel(struct nstr_item *, struct emp_qelem *,
|
||||||
struct sctstr *, int, int, int, int);
|
struct sctstr *, int, int, int, int);
|
||||||
extern int pln_arm(struct emp_qelem *, int, char, struct ichrstr *,
|
extern int pln_arm(struct emp_qelem *, int, char, struct ichrstr *,
|
||||||
|
|
|
@ -902,67 +902,6 @@ oprange(struct empobj *gp, int *radius)
|
||||||
return range;
|
return range;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
mission_pln_wanted(struct plnstr *pp, int wantflags, int nowantflags)
|
|
||||||
{
|
|
||||||
int y, bad, bad1;
|
|
||||||
unsigned x;
|
|
||||||
struct plchrstr *pcp = plchr + pp->pln_type;
|
|
||||||
|
|
||||||
bad = 0;
|
|
||||||
bad1 = 0;
|
|
||||||
if (wantflags) {
|
|
||||||
for (x = 0; x < sizeof(wantflags) * 8; x++) {
|
|
||||||
y = (1 << x);
|
|
||||||
if ((wantflags & y) == y)
|
|
||||||
if ((pcp->pl_flags & y) != y) {
|
|
||||||
switch (y) {
|
|
||||||
case P_F:
|
|
||||||
case P_ESC:
|
|
||||||
bad1 = 2;
|
|
||||||
break;
|
|
||||||
case P_E:
|
|
||||||
case P_L:
|
|
||||||
case P_K:
|
|
||||||
bad1 = 1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
bad = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (bad) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (bad1 == 2) {
|
|
||||||
if ((pcp->pl_flags & P_ESC) || (pcp->pl_flags & P_F))
|
|
||||||
bad1 = 0;
|
|
||||||
}
|
|
||||||
if (bad1 == 1) {
|
|
||||||
if ((pcp->pl_flags & P_E) ||
|
|
||||||
(pcp->pl_flags & P_K) || (pcp->pl_flags & P_L))
|
|
||||||
bad1 = 0;
|
|
||||||
}
|
|
||||||
if (bad1) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bad = 0;
|
|
||||||
bad1 = 0;
|
|
||||||
if (nowantflags) {
|
|
||||||
for (x = 0; x < sizeof(nowantflags) * 8; x++) {
|
|
||||||
y = (1 << x);
|
|
||||||
if ((nowantflags & y) == y)
|
|
||||||
if ((pcp->pl_flags & y) == y)
|
|
||||||
bad = 1;
|
|
||||||
}
|
|
||||||
if (bad) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove all planes who cannot go on
|
* Remove all planes who cannot go on
|
||||||
* the mission from the plane list.
|
* the mission from the plane list.
|
||||||
|
@ -1007,7 +946,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mission_pln_wanted(pp, wantflags, nowantflags)) {
|
if (!pln_wanted(pp, wantflags, nowantflags)) {
|
||||||
emp_remque(qp);
|
emp_remque(qp);
|
||||||
free(qp);
|
free(qp);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -359,7 +359,7 @@ pln_mine(struct emp_qelem *list, struct sctstr *sectp)
|
||||||
* - it lacks any of the other flags in wantflags, or
|
* - it lacks any of the other flags in wantflags, or
|
||||||
* - it has any of the flags in nowantflags.
|
* - it has any of the flags in nowantflags.
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
pln_wanted(struct plnstr *pp, int wantflags, int nowantflags)
|
pln_wanted(struct plnstr *pp, int wantflags, int nowantflags)
|
||||||
{
|
{
|
||||||
int flags = plchr[(int)pp->pln_type].pl_flags;
|
int flags = plchr[(int)pp->pln_type].pl_flags;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue