From fd4da5aab3d306219bea487bd8c378490c533d0d Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 27 Sep 2009 14:44:39 -0400 Subject: [PATCH] Make bomb require capability bomber or tactical Before, bomb selected any plane, but planes with zero load could not be equipped. Cargo planes could be equipped fine, and they flew bombs to the target, where they silently vanished. Closes#1388263. --- src/lib/commands/bomb.c | 2 +- src/lib/subs/plnsub.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/commands/bomb.c b/src/lib/commands/bomb.c index 5be840b2..387b3f24 100644 --- a/src/lib/commands/bomb.c +++ b/src/lib/commands/bomb.c @@ -127,7 +127,7 @@ bomb(void) * select planes within range */ pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target, - 2, 0, P_M | P_O); + 2, P_B | P_T, P_M | P_O); pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target, 2, P_ESC | P_F, P_M | P_O); /* diff --git a/src/lib/subs/plnsub.c b/src/lib/subs/plnsub.c index f03939df..3a5aa45a 100644 --- a/src/lib/subs/plnsub.c +++ b/src/lib/subs/plnsub.c @@ -360,6 +360,7 @@ pln_mine(struct emp_qelem *list, coord tx, coord ty) /* * Has PP's type capabilities satisfying WANTFLAGS and NOWANTFLAGS? * A plane type is capable unless + * - it lacks all of the P_B, P_T in WANTFLAGS, or * - it lacks all of the P_F, P_ESC in WANTFLAGS, or * - it lacks all of the P_E, P_L, P_K in WANTFLAGS, or * - it lacks any of the other capabilities in WANTFLAGS, or @@ -370,6 +371,12 @@ pln_capable(struct plnstr *pp, int wantflags, int nowantflags) { int flags = plchr[(int)pp->pln_type].pl_flags; + if (wantflags & (P_B | P_T)) { + if ((flags & wantflags & (P_B | P_T)) == 0) + return 0; + wantflags &= ~(P_B | P_T); + } + if (wantflags & (P_F | P_ESC)) { if ((flags & wantflags & (P_F | P_ESC)) == 0) return 0;