]> git.pond.sub.org Git - empserver/commitdiff
Simplify plane selection for drop, fly, recon and sweep
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 27 Sep 2009 19:07:57 +0000 (15:07 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 8 Dec 2009 07:15:51 +0000 (08:15 +0100)
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.

src/lib/commands/bomb.c
src/lib/commands/drop.c
src/lib/commands/fly.c
src/lib/commands/para.c
src/lib/commands/reco.c

index 387b3f2493dba2bc095cafeeac58befa9dce7ec7..2a8bbeb26fd9f1c6bff535997c6973b8d30496ab 100644 (file)
@@ -126,10 +126,10 @@ bomb(void)
     /*
      * select planes within range
      */
-    pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target,
-           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);
+    pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target, 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);
     /*
      * now arm and equip the bombers, transports, whatever.
      */
index 308fa8e2273c566469d1241c62c64607eeb0f11a..3bcf2c79c50a30471d6a01e8120ffacb3e2783e9 100644 (file)
@@ -99,14 +99,10 @@ drop(void)
     /*
      * select planes within range
      */
-    pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target,
-           2, wantflags, P_M | P_O);
-    if (QEMPTY(&bomb_list)) {
-       pr("No planes could be equipped for the mission.\n");
-       return RET_FAIL;
-    }
-    pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target,
-           2, P_ESC | P_F, P_M | P_O);
+    pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target, 2,
+           wantflags, P_M | P_O);
+    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.
      */
index 297b389825606c9bf586da04b30cb3c281f575ce..0fb784677bc379408f98a9abdda4c6d2ee7e0418 100644 (file)
@@ -94,14 +94,10 @@ fly(void)
     /*
      * select planes within range
      */
-    pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target,
-           1, wantflags, P_M | P_O);
-    if (QEMPTY(&bomb_list)) {
-       pr("No planes could be equipped for the mission.\n");
-       return RET_FAIL;
-    }
-    pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target,
-           1, wantflags | P_ESC | P_F, P_M | P_O);
+    pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target, 1,
+           wantflags, 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)) {
        pr("Not enough room on ship #%d!\n", cno);
        return RET_FAIL;
index bb2e952da159242a73d81869aca97fca78fc6c89..33faa339085a87f541ea7d1579990af4384b0bc6 100644 (file)
@@ -85,10 +85,10 @@ para(void)
     /*
      * select planes within range
      */
-    pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target,
-           2, P_P | P_C, P_M | P_O);
-    pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target,
-           2, P_ESC | P_F, P_M | P_O);
+    pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target, 2,
+           P_P | P_C, P_M | P_O);
+    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.
      */
index 1716328661271430159e7e052955e125b23d69e7..3f6b044f0cb4e848c2f241d2881e0062ea806238 100644 (file)
@@ -81,14 +81,11 @@ reco(void)
     /*
      * select planes within range
      */
-    pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target,
-           1, wantflags | (mission_flags & PM_S ? P_SWEEP : 0), P_M | P_O);
-    if (QEMPTY(&bomb_list)) {
-       pr("No planes could be equipped for the mission.\n");
-       return RET_FAIL;
-    }
-    pln_sel(&ni_esc, &esc_list, &ap_sect, ap_to_target,
-           1, wantflags | P_ESC | P_F, P_M | P_O);
+    pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target, 1,
+           wantflags | (mission_flags & PM_S ? P_SWEEP : 0),
+           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)) {
        pr("Not enough room on ship #%d!\n", cno);
        return RET_FAIL;