assault: Simplify only_spies()

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2016-07-23 17:09:54 +02:00
parent f15f0cc687
commit 97dd515378

View file

@ -170,26 +170,24 @@ assa(void)
static int static int
only_spies(struct combat off[], struct emp_qelem *olist) only_spies(struct combat off[], struct emp_qelem *olist)
{ {
int ourtotal;
int n; int n;
struct emp_qelem *qp, *next; struct emp_qelem *qp;
struct ulist *llp; struct ulist *llp;
ourtotal = 0;
for (n = 0; n <= off->last; n++) { for (n = 0; n <= off->last; n++) {
if (off[n].type == EF_BAD) if (off[n].type == EF_BAD)
continue; continue;
ourtotal += off[n].troops * att_combat_eff(off + n); if (off[n].troops)
} return 0;
for (qp = olist->q_forw; qp != olist; qp = next) {
next = qp->q_forw;
llp = (struct ulist *)qp;
if (lchr[(int)llp->unit.land.lnd_type].l_flags & L_SPY)
continue;
ourtotal++;
} }
return ourtotal == 0; for (qp = olist->q_forw; qp != olist; qp = qp->q_forw) {
llp = (struct ulist *)qp;
if (!(lchr[llp->unit.land.lnd_type].l_flags & L_SPY))
return 0;
}
return 1;
} }
static void static void