Simplify wantflags calculation in bomb(), fly(), para(), reco()

This commit is contained in:
Markus Armbruster 2009-09-27 11:10:08 -04:00
parent df1ca95a2a
commit b2e6663f39
4 changed files with 5 additions and 13 deletions

View file

@ -91,7 +91,6 @@ bomb(void)
struct sctstr target; struct sctstr target;
struct emp_qelem bomb_list; struct emp_qelem bomb_list;
struct emp_qelem esc_list; struct emp_qelem esc_list;
int wantflags;
struct sctstr ap_sect; struct sctstr ap_sect;
char mission; char mission;
struct plist *plp; struct plist *plp;
@ -100,7 +99,6 @@ bomb(void)
struct natstr *natp; struct natstr *natp;
char buf[1024]; char buf[1024];
wantflags = 0;
if (get_planes(&ni_bomb, &ni_esc, player->argp[1], player->argp[2]) < 0) if (get_planes(&ni_bomb, &ni_esc, player->argp[1], player->argp[2]) < 0)
return RET_SYN; return RET_SYN;
p = getstarg(player->argp[3], "pinpoint, or strategic? ", buf); p = getstarg(player->argp[3], "pinpoint, or strategic? ", buf);
@ -129,9 +127,9 @@ bomb(void)
* select planes within range * select planes within range
*/ */
pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target, pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target,
2, wantflags, P_M | P_O); 2, 0, P_M | P_O);
pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target, pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target,
2, wantflags | P_F | P_ESC, P_M | P_O); 2, P_ESC | P_F, P_M | P_O);
/* /*
* now arm and equip the bombers, transports, whatever. * now arm and equip the bombers, transports, whatever.
*/ */

View file

@ -100,10 +100,8 @@ fly(void)
pr("No planes could be equipped for the mission.\n"); pr("No planes could be equipped for the mission.\n");
return RET_FAIL; return RET_FAIL;
} }
wantflags |= P_F;
wantflags |= P_ESC;
pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target, pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target,
1, wantflags, P_M | P_O); 1, wantflags | P_ESC | P_F, P_M | P_O);
if (cno >= 0 && !pln_oneway_to_carrier_ok(&bomb_list, &esc_list, cno)) { if (cno >= 0 && !pln_oneway_to_carrier_ok(&bomb_list, &esc_list, cno)) {
pr("Not enough room on ship #%d!\n", cno); pr("Not enough room on ship #%d!\n", cno);
return RET_FAIL; return RET_FAIL;

View file

@ -57,11 +57,9 @@ para(void)
struct sctstr target; struct sctstr target;
struct emp_qelem bomb_list; struct emp_qelem bomb_list;
struct emp_qelem esc_list; struct emp_qelem esc_list;
int wantflags;
struct sctstr ap_sect; struct sctstr ap_sect;
char buf[1024]; char buf[1024];
wantflags = P_P;
if (get_planes(&ni_bomb, &ni_esc, player->argp[1], player->argp[2]) < 0) if (get_planes(&ni_bomb, &ni_esc, player->argp[1], player->argp[2]) < 0)
return RET_SYN; return RET_SYN;
if (!get_assembly_point(player->argp[3], &ap_sect, buf)) if (!get_assembly_point(player->argp[3], &ap_sect, buf))
@ -84,7 +82,7 @@ para(void)
* select planes within range * select planes within range
*/ */
pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target, pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target,
2, P_C | wantflags, P_M | P_O); 2, P_P | P_C, P_M | P_O);
pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target, pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target,
2, P_ESC | P_F, P_M | P_O); 2, P_ESC | P_F, P_M | P_O);
/* /*

View file

@ -86,10 +86,8 @@ reco(void)
pr("No planes could be equipped for the mission.\n"); pr("No planes could be equipped for the mission.\n");
return RET_FAIL; return RET_FAIL;
} }
wantflags |= P_F;
wantflags |= P_ESC;
pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target, pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target,
1, wantflags, P_M | P_O); 1, wantflags | P_ESC | P_F, P_M | P_O);
if (cno >= 0 && !pln_oneway_to_carrier_ok(&bomb_list, &esc_list, cno)) { if (cno >= 0 && !pln_oneway_to_carrier_ok(&bomb_list, &esc_list, cno)) {
pr("Not enough room on ship #%d!\n", cno); pr("Not enough room on ship #%d!\n", cno);
return RET_FAIL; return RET_FAIL;