(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.
This commit is contained in:
Markus Armbruster 2007-11-22 19:33:14 +00:00
parent e143bb585c
commit 836833e321
3 changed files with 10 additions and 7 deletions

View 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 void pln_mine(struct emp_qelem *list, struct sctstr *sectp);
extern int pln_capable(struct plnstr *, int, int); extern int pln_capable(struct plnstr *, int, int);
extern int pln_airbase_ok(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 *, extern void pln_sel(struct nstr_item *, struct emp_qelem *,
struct sctstr *, int, int, int, int); struct sctstr *, int, int, int, int);
extern int pln_arm(struct emp_qelem *, int, char, struct ichrstr *, extern int pln_arm(struct emp_qelem *, int, char, struct ichrstr *,

View file

@ -101,7 +101,7 @@ carriersatxy(coord x, coord y, natid own)
if (ship.shp_own != own if (ship.shp_own != own
&& getrel(getnatp(ship.shp_own), own) != ALLIED) && getrel(getnatp(ship.shp_own), own) != ALLIED)
continue; continue;
if ((carrier_planes(&ship) & (P_L | P_K)) == 0) if ((carrier_planes(&ship, 0) & (P_L | P_K)) == 0)
continue; continue;
if (first) { if (first) {
pr(" # owner eff type\n"); pr(" # owner eff type\n");

View file

@ -131,7 +131,7 @@ pln_onewaymission(struct sctstr *target, int *shipno, int *flagp)
xyas(target->sct_x, target->sct_y, player->cnum)); xyas(target->sct_x, target->sct_y, player->cnum));
continue; continue;
} }
fl = carrier_planes(&ship); fl = carrier_planes(&ship, 0);
if (fl == 0) { if (fl == 0) {
pr("Can't land on %s.\n", prship(&ship)); pr("Can't land on %s.\n", prship(&ship));
continue; 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. * 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 * It's zero if SP can't support air operations due to its type or
* state (low efficiency). * state (low efficiency).
*/ */
int int
carrier_planes(struct shpstr *sp) carrier_planes(struct shpstr *sp, int msl)
{ {
struct mchrstr *mcp = mchr + sp->shp_type; struct mchrstr *mcp = mchr + sp->shp_type;
int res; int res;
@ -394,7 +395,9 @@ carrier_planes(struct shpstr *sp)
res = 0; res = 0;
if (mcp->m_flags & M_FLY) if (mcp->m_flags & M_FLY)
res |= P_L; 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; res |= P_K;
if (mcp->m_flags & M_XLIGHT) if (mcp->m_flags & M_XLIGHT)
res |= P_E; res |= P_E;
@ -425,7 +428,7 @@ pln_airbase_ok(struct plnstr *pp, int oneway, int noisy)
prplane(pp)); prplane(pp));
return 0; return 0;
} }
if ((carrier_planes(&ship) & pcp->pl_flags) == 0) if (!(carrier_planes(&ship, pcp->pl_flags & P_M) & pcp->pl_flags))
return 0; return 0;
} else if (pp->pln_land >= 0) { } else if (pp->pln_land >= 0) {