Fix bombing of submarines with mixed force

When bombing ships with a force containing both planes with and
without capability ASW, pin_bomb() could fail to report presence of
submarines, and could refuse to bomb ships when there were only
submarines.  The culprit is pin_bomb()'s check for capability ASW: it
checked whether the first plane in the plane list was capable instead
of checking whether any plane in the list was capable.
This commit is contained in:
Markus Armbruster 2009-03-08 17:36:37 +01:00
parent f760150d8f
commit f10af4dea0

View file

@ -186,7 +186,6 @@ pin_bomb(struct emp_qelem *list, struct sctstr *target)
int type; int type;
int bad; int bad;
char *p; char *p;
struct plist *plp;
int nsubs; int nsubs;
int nunits; int nunits;
struct natstr *natp; struct natstr *natp;
@ -200,9 +199,8 @@ pin_bomb(struct emp_qelem *list, struct sctstr *target)
pr("Target sector is a %s constructed %s\n", pr("Target sector is a %s constructed %s\n",
effadv((int)target->sct_effic), dcp->d_name); effadv((int)target->sct_effic), dcp->d_name);
nsubs = 0; nsubs = 0;
plp = (struct plist *)list->q_forw;
nships = shipsatxy(target->sct_x, target->sct_y, 0, M_SUB, 0); nships = shipsatxy(target->sct_x, target->sct_y, 0, M_SUB, 0);
if (plp->pcp->pl_flags & P_A) { if (pln_caps(list) & P_A) {
nsubs = shipsatxy(target->sct_x, target->sct_y, M_SUB, 0, 1); nsubs = shipsatxy(target->sct_x, target->sct_y, M_SUB, 0, 1);
if (nsubs > 0) if (nsubs > 0)
pr("Some subs are present in the sector.\n"); pr("Some subs are present in the sector.\n");
@ -261,7 +259,7 @@ pin_bomb(struct emp_qelem *list, struct sctstr *target)
break; break;
case 's': case 's':
if (nships == 0) { if (nships == 0) {
if (((struct plist *)list->q_forw)->pcp->pl_flags & P_A) { if (pln_caps(list) & P_A) {
if (nsubs == 0) { if (nsubs == 0) {
pr("no ships there\n"); pr("no ships there\n");
goto retry; goto retry;