(carriersatxy): Remove parameters wantflags, nowantflags, and use
carrier_planes() instead, ignoring carriers that can only operate x-light planes. No functional change. (carrier_planes): External linkage.
This commit is contained in:
parent
d5afd757a9
commit
6992bcfe9a
3 changed files with 6 additions and 17 deletions
|
@ -482,7 +482,7 @@ extern double fortrange(struct sctstr *);
|
||||||
extern int roundrange(double);
|
extern int roundrange(double);
|
||||||
/* list.c */
|
/* list.c */
|
||||||
extern int shipsatxy(coord, coord, int, int);
|
extern int shipsatxy(coord, coord, int, int);
|
||||||
extern int carriersatxy(coord, coord, int, int, natid);
|
extern int carriersatxy(coord, coord, natid);
|
||||||
extern int unitsatxy(coord, coord, int, int);
|
extern int unitsatxy(coord, coord, int, int);
|
||||||
extern int planesatxy(coord, coord, int, int, struct emp_qelem *);
|
extern int planesatxy(coord, coord, int, int, struct emp_qelem *);
|
||||||
extern int asw_shipsatxy(coord, coord, int, int, struct plnstr *,
|
extern int asw_shipsatxy(coord, coord, int, int, struct plnstr *,
|
||||||
|
@ -558,6 +558,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 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 *,
|
||||||
|
|
|
@ -85,12 +85,11 @@ shipsatxy(coord x, coord y, int wantflags, int nowantflags)
|
||||||
/* This one only shows owned or allied ships */
|
/* This one only shows owned or allied ships */
|
||||||
|
|
||||||
int
|
int
|
||||||
carriersatxy(coord x, coord y, int wantflags, int nowantflags, natid own)
|
carriersatxy(coord x, coord y, natid own)
|
||||||
{
|
{
|
||||||
int first;
|
int first;
|
||||||
int ships;
|
int ships;
|
||||||
struct nstr_item ni;
|
struct nstr_item ni;
|
||||||
struct mchrstr *mp;
|
|
||||||
struct shpstr ship;
|
struct shpstr ship;
|
||||||
|
|
||||||
first = 1;
|
first = 1;
|
||||||
|
@ -102,17 +101,8 @@ carriersatxy(coord x, coord y, int wantflags, int nowantflags, 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 (ship.shp_effic < SHP_AIROPS_EFF)
|
if ((carrier_planes(&ship) & (P_L | P_K)) == 0)
|
||||||
continue;
|
continue;
|
||||||
mp = &mchr[(int)ship.shp_type];
|
|
||||||
if (wantflags) {
|
|
||||||
if ((mp->m_flags & wantflags) == 0)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (nowantflags) {
|
|
||||||
if (mp->m_flags & nowantflags)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (first) {
|
if (first) {
|
||||||
pr(" # owner eff type\n");
|
pr(" # owner eff type\n");
|
||||||
first = 0;
|
first = 0;
|
||||||
|
|
|
@ -55,7 +55,6 @@
|
||||||
#include "ship.h"
|
#include "ship.h"
|
||||||
#include "xy.h"
|
#include "xy.h"
|
||||||
|
|
||||||
static int carrier_planes(struct shpstr *);
|
|
||||||
static int pln_equip(struct plist *, struct ichrstr *, int, char);
|
static int pln_equip(struct plist *, struct ichrstr *, int, char);
|
||||||
static int fit_plane_on_ship(struct plnstr *, struct shpstr *);
|
static int fit_plane_on_ship(struct plnstr *, struct shpstr *);
|
||||||
|
|
||||||
|
@ -113,8 +112,7 @@ pln_onewaymission(struct sctstr *target, int *shipno, int *flagp)
|
||||||
flags = *flagp;
|
flags = *flagp;
|
||||||
|
|
||||||
/* offer carriers */
|
/* offer carriers */
|
||||||
nships = carriersatxy(target->sct_x, target->sct_y,
|
nships = carriersatxy(target->sct_x, target->sct_y, player->cnum);
|
||||||
M_FLY | M_CHOPPER, 0, player->cnum);
|
|
||||||
if (nships) {
|
if (nships) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (!(p = getstarg(0, "Carrier #? ", buf)) || !*p)
|
if (!(p = getstarg(0, "Carrier #? ", buf)) || !*p)
|
||||||
|
@ -384,7 +382,7 @@ pln_capable(struct plnstr *pp, int wantflags, int nowantflags)
|
||||||
* 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).
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
carrier_planes(struct shpstr *sp)
|
carrier_planes(struct shpstr *sp)
|
||||||
{
|
{
|
||||||
struct mchrstr *mcp = mchr + sp->shp_type;
|
struct mchrstr *mcp = mchr + sp->shp_type;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue