]> git.pond.sub.org Git - empserver/commitdiff
(carrier_planes): New parameter msl.
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 22 Nov 2007 19:33:14 +0000 (19:33 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 22 Nov 2007 19:33:14 +0000 (19:33 +0000)
(carriersatxy, pln_onewaymission): Pass zero.  No functional change.
(pln_airbase_ok): Pass whether the plane is a missile.  This fixes
non-x-light missiles on ships without capability M_FLY.  Broken in
rev. 1.76.  Launch and interdict weren't affected.  Air defense was,
but the stock game has only x-light SAMs.

include/prototypes.h
src/lib/subs/list.c
src/lib/subs/plnsub.c

index c2c2f9fda22a9f214e50c4e25f3fadbc03e26e19..670ea38c40fbe875cfcfdd4711b26087b4d51b34 100644 (file)
@@ -557,7 +557,7 @@ extern void pln_dropoff(struct emp_qelem *, struct ichrstr *,
 extern void pln_mine(struct emp_qelem *list, struct sctstr *sectp);
 extern int pln_capable(struct plnstr *, int, int);
 extern int pln_airbase_ok(struct plnstr *, int, int);
-extern int carrier_planes(struct shpstr *);
+extern int carrier_planes(struct shpstr *, int);
 extern void pln_sel(struct nstr_item *, struct emp_qelem *,
                    struct sctstr *, int, int, int, int);
 extern int pln_arm(struct emp_qelem *, int, char, struct ichrstr *,
index 81293f3759fdb3eedf553eaba9d4b1ed7e8e76d7..3fa02aaa63dc2edf350424220e0ea81ed48c1103 100644 (file)
@@ -101,7 +101,7 @@ carriersatxy(coord x, coord y, natid own)
        if (ship.shp_own != own
            && getrel(getnatp(ship.shp_own), own) != ALLIED)
            continue;
-       if ((carrier_planes(&ship) & (P_L | P_K)) == 0)
+       if ((carrier_planes(&ship, 0) & (P_L | P_K)) == 0)
            continue;
        if (first) {
            pr(" #          owner           eff       type\n");
index 96a5ad9f769b0dce81a9ba487ff31cb3b6189479..9140a656c73e584390de91cc7398fbbec29df44a 100644 (file)
@@ -131,7 +131,7 @@ pln_onewaymission(struct sctstr *target, int *shipno, int *flagp)
                   xyas(target->sct_x, target->sct_y, player->cnum));
                continue;
            }
-           fl = carrier_planes(&ship);
+           fl = carrier_planes(&ship, 0);
            if (fl == 0) {
                pr("Can't land on %s.\n", prship(&ship));
                continue;
@@ -377,13 +377,14 @@ pln_capable(struct plnstr *pp, int wantflags, int nowantflags)
 }
 
 /*
- * Find non-missile plane types that can operate from carrier SP.
+ * Find plane types that can operate from carrier SP.
+ * If MSL find missile types, else non-missile types.
  * Return a combination of P_L, P_K, P_E.
  * It's zero if SP can't support air operations due to its type or
  * state (low efficiency).
  */
 int
-carrier_planes(struct shpstr *sp)
+carrier_planes(struct shpstr *sp, int msl)
 {
     struct mchrstr *mcp = mchr + sp->shp_type;
     int res;
@@ -394,7 +395,9 @@ carrier_planes(struct shpstr *sp)
     res = 0;
     if (mcp->m_flags & M_FLY)
        res |= P_L;
-    if (mcp->m_flags & M_CHOPPER)
+    if ((mcp->m_flags & M_MSL) && msl)
+       res |= P_L;
+    if ((mcp->m_flags & M_CHOPPER) && !msl)
        res |= P_K;
     if (mcp->m_flags & M_XLIGHT)
        res |= P_E;
@@ -425,7 +428,7 @@ pln_airbase_ok(struct plnstr *pp, int oneway, int noisy)
                   prplane(pp));
            return 0;
        }
-       if ((carrier_planes(&ship) & pcp->pl_flags) == 0)
+       if (!(carrier_planes(&ship, pcp->pl_flags & P_M) & pcp->pl_flags))
            return 0;
 
     } else if (pp->pln_land >= 0) {