mission: Don't permit SAMs on escort missions
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 4 Jan 2021 08:58:52 +0000 (09:58 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 23 Jan 2021 07:39:13 +0000 (08:39 +0100)
The mission code doesn't treat SAMs specially: they take off, fly out,
maybe fight, fly home, and land.  Landing triggers the oops in
pln_put1().

Letting SAMs escort makes no sense.  Fix the mission command to reject
them.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/commands/miss.c

index 0e49a055caaff95d86ad0b56c71ec13a06bca671..52b3919b98e3e520da7cb239830363b1f363160c 100644 (file)
@@ -29,7 +29,7 @@
  *  Known contributors to this file:
  *     Thomas Ruschak, 1992
  *     Steve McClure, 2000
- *     Markus Armbruster, 2005-2016
+ *     Markus Armbruster, 2005-2021
  */
 
 #include <config.h>
@@ -222,6 +222,12 @@ mission(void)
            struct plchrstr *pcp;
 
            pcp = &plchr[(int)gp->type];
+           if (pcp->pl_flags & P_M) {
+               pr("Missiles can't escort.\n"
+                  "%s #%d is ineligible\n",
+                  pcp->pl_name, gp->uid);
+               continue;
+           }
            if (!(pcp->pl_flags & P_ESC) && !(pcp->pl_flags & P_F)) {
                pr("Only planes with the escort or intercept abilities can escort.\n"
                   "%s #%d is ineligible\n",