From 836833e3213707150e642c67ff28fbe50a1cd5e6 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 22 Nov 2007 19:33:14 +0000 Subject: [PATCH] (carrier_planes): New parameter msl. (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 | 2 +- src/lib/subs/list.c | 2 +- src/lib/subs/plnsub.c | 13 ++++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/prototypes.h b/include/prototypes.h index c2c2f9fd..670ea38c 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -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 *, diff --git a/src/lib/subs/list.c b/src/lib/subs/list.c index 81293f37..3fa02aaa 100644 --- a/src/lib/subs/list.c +++ b/src/lib/subs/list.c @@ -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"); diff --git a/src/lib/subs/plnsub.c b/src/lib/subs/plnsub.c index 96a5ad9f..9140a656 100644 --- a/src/lib/subs/plnsub.c +++ b/src/lib/subs/plnsub.c @@ -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) {