Simplify plane selection for drop, fly, recon and sweep
Plane flying commands first select the planes to fly the mission and their escorts, then equip them. They all fail when no planes to fly the mission can be equipped. Unlike bomb and paradrop, commands drop, fly, recon and sweep had an additional check that made them fail when no planes to fly the mission could be selected. Because "none selected" implies "none equipped", the additional check is redundant. Remove it. While there, break lines in calls of pln_sel() more tastefully.
This commit is contained in:
parent
fd4da5aab3
commit
29a6baca6d
5 changed files with 21 additions and 32 deletions
|
@ -126,10 +126,10 @@ 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,
|
||||||
2, P_B | P_T, P_M | P_O);
|
P_B | P_T, 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,
|
||||||
2, P_ESC | P_F, P_M | P_O);
|
P_ESC | P_F, P_M | P_O);
|
||||||
/*
|
/*
|
||||||
* now arm and equip the bombers, transports, whatever.
|
* now arm and equip the bombers, transports, whatever.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -99,14 +99,10 @@ drop(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,
|
||||||
2, wantflags, P_M | P_O);
|
wantflags, P_M | P_O);
|
||||||
if (QEMPTY(&bomb_list)) {
|
pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target, 2,
|
||||||
pr("No planes could be equipped for the mission.\n");
|
P_ESC | P_F, P_M | P_O);
|
||||||
return RET_FAIL;
|
|
||||||
}
|
|
||||||
pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target,
|
|
||||||
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.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -94,14 +94,10 @@ fly(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, 1,
|
||||||
1, wantflags, P_M | P_O);
|
wantflags, P_M | P_O);
|
||||||
if (QEMPTY(&bomb_list)) {
|
pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target, 1,
|
||||||
pr("No planes could be equipped for the mission.\n");
|
wantflags | P_ESC | P_F, P_M | P_O);
|
||||||
return RET_FAIL;
|
|
||||||
}
|
|
||||||
pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target,
|
|
||||||
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;
|
||||||
|
|
|
@ -85,10 +85,10 @@ 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,
|
||||||
2, P_P | P_C, P_M | P_O);
|
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,
|
||||||
2, P_ESC | P_F, P_M | P_O);
|
P_ESC | P_F, P_M | P_O);
|
||||||
/*
|
/*
|
||||||
* now arm and equip the bombers, transports, whatever.
|
* now arm and equip the bombers, transports, whatever.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -81,14 +81,11 @@ reco(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, 1,
|
||||||
1, wantflags | (mission_flags & PM_S ? P_SWEEP : 0), P_M | P_O);
|
wantflags | (mission_flags & PM_S ? P_SWEEP : 0),
|
||||||
if (QEMPTY(&bomb_list)) {
|
P_M | P_O);
|
||||||
pr("No planes could be equipped for the mission.\n");
|
pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target, 1,
|
||||||
return RET_FAIL;
|
wantflags | P_ESC | P_F, P_M | P_O);
|
||||||
}
|
|
||||||
pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target,
|
|
||||||
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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue