From f10af4dea0778dad2df7e51ec52ee745977315a9 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 8 Mar 2009 17:36:37 +0100 Subject: [PATCH] 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. --- src/lib/commands/bomb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib/commands/bomb.c b/src/lib/commands/bomb.c index 48da3fba..89ccfd20 100644 --- a/src/lib/commands/bomb.c +++ b/src/lib/commands/bomb.c @@ -186,7 +186,6 @@ pin_bomb(struct emp_qelem *list, struct sctstr *target) int type; int bad; char *p; - struct plist *plp; int nsubs; int nunits; 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", effadv((int)target->sct_effic), dcp->d_name); nsubs = 0; - plp = (struct plist *)list->q_forw; 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); if (nsubs > 0) pr("Some subs are present in the sector.\n"); @@ -261,7 +259,7 @@ pin_bomb(struct emp_qelem *list, struct sctstr *target) break; case 's': if (nships == 0) { - if (((struct plist *)list->q_forw)->pcp->pl_flags & P_A) { + if (pln_caps(list) & P_A) { if (nsubs == 0) { pr("no ships there\n"); goto retry;