coord, coord, void *, int);
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 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 *,
return range;
}
-static int
-mission_pln_airbase_ok(struct plnstr *pp)
-{
- struct shpstr ship;
- struct lndstr land;
- struct sctstr sect;
- struct plchrstr *pcp = plchr + pp->pln_type;
-
- if (pp->pln_ship >= 0) {
- if (!getship(pp->pln_ship, &ship)) {
- CANT_REACH();
- return 0;
- }
- if (CANT_HAPPEN(ship.shp_effic < SHIP_MINEFF
- || !could_be_on_ship(pp, &ship)))
- return 0;
-
- if (ship.shp_own != pp->pln_own
- && getrel(getnatp(ship.shp_own), pp->pln_own) != ALLIED) {
- return 0;
- }
- if (ship.shp_effic < SHP_AIROPS_EFF)
- return 0;
-
- } else if (pp->pln_land >= 0) {
- if (!getland(pp->pln_land, &land)) {
- CANT_REACH();
- return 0;
- }
- if (CANT_HAPPEN(land.lnd_effic < LAND_MINEFF
- || !(pcp->pl_flags & P_E)))
- return 0;
-
- if (land.lnd_own != pp->pln_own
- && getrel(getnatp(land.lnd_own), pp->pln_own) != ALLIED)
- return 0;
- if (land.lnd_effic < LND_AIROPS_EFF)
- return 0;
- if (land.lnd_ship >= 0 || land.lnd_land >= 0) {
- return 0;
- }
-
- } else {
- if (!getsect(pp->pln_x, pp->pln_y, §)) {
- CANT_REACH();
- return 0;
- }
- /* First, check allied status */
- /* Can't fly from non-owned sectors or non-allied sectors */
- if ((sect.sct_own != pp->pln_own) &&
- (getrel(getnatp(sect.sct_own), pp->pln_own) != ALLIED)) {
- return 0;
- }
- /* non-vtol plane */
- if ((pcp->pl_flags & P_V) == 0) {
- if ((sect.sct_type != SCT_AIRPT) || (sect.sct_effic < 40)) {
- return 0;
- }
- }
- }
-
- return 1;
-}
-
/*
* Remove all planes who cannot go on
* the mission from the plane list.
continue;
}
- if (!mission_pln_airbase_ok(pp)) {
+ if (!pln_airbase_ok(pp, 0, 0)) {
emp_remque(qp);
free(qp);
continue;
return 1;
}
-static int
-pln_airbase_ok(struct plnstr *pp, int oneway)
+int
+pln_airbase_ok(struct plnstr *pp, int oneway, int noisy)
{
struct shpstr ship;
struct lndstr land;
struct sctstr sect;
struct plchrstr *pcp = plchr + pp->pln_type;
- if (CANT_HAPPEN(pp->pln_own != player->cnum))
- return 0;
+ if (CANT_HAPPEN(noisy && pp->pln_own != player->cnum))
+ noisy = 0;
if (pp->pln_ship >= 0) {
/* ship: needs to be own or allied, efficient */
if (ship.shp_own != pp->pln_own
&& getrel(getnatp(ship.shp_own), pp->pln_own) != ALLIED) {
- pr("(note) An ally does not own the ship %s is on\n",
- prplane(pp));
+ if (noisy)
+ pr("(note) An ally does not own the ship %s is on\n",
+ prplane(pp));
return 0;
}
if (ship.shp_effic < SHP_AIROPS_EFF)
if (land.lnd_own != pp->pln_own
&& getrel(getnatp(land.lnd_own), pp->pln_own) != ALLIED) {
- pr("(note) An ally does not own the unit %s is on\n",
- prplane(pp));
+ if (noisy)
+ pr("(note) An ally does not own the unit %s is on\n",
+ prplane(pp));
return 0;
}
if (land.lnd_effic < LND_AIROPS_EFF)
if (sect.sct_own != pp->pln_own
&& getrel(getnatp(sect.sct_own), pp->pln_own) != ALLIED) {
- pr("(note) An ally does not own the sector %s is in\n",
- prplane(pp));
+ if (noisy)
+ pr("(note) An ally does not own the sector %s is in\n",
+ prplane(pp));
return 0;
}
/* need airfield unless VTOL */
if ((pcp->pl_flags & P_V) == 0) {
if (sect.sct_type != SCT_AIRPT) {
- pr("%s not at airport\n", prplane(pp));
+ if (noisy)
+ pr("%s not at airport\n", prplane(pp));
return 0;
}
if (sect.sct_effic < 40) {
- pr("%s is not 40%% efficient, %s can't take off from there.\n",
- xyas(sect.sct_x, sect.sct_y, pp->pln_own),
- prplane(pp));
+ if (noisy)
+ pr("%s is not 40%% efficient, %s can't take off from there.\n",
+ xyas(sect.sct_x, sect.sct_y, pp->pln_own),
+ prplane(pp));
return 0;
}
if (!oneway && sect.sct_effic < 60) {
- pr("%s is not 60%% efficient, %s can't land there.\n",
- xyas(sect.sct_x, sect.sct_y, pp->pln_own),
- prplane(pp));
+ if (noisy)
+ pr("%s is not 60%% efficient, %s can't land there.\n",
+ xyas(sect.sct_x, sect.sct_y, pp->pln_own),
+ prplane(pp));
return 0;
}
}
prplane(&plane), plane.pln_range, range);
continue;
}
- if (!pln_airbase_ok(&plane, rangemult != 2))
+ if (!pln_airbase_ok(&plane, rangemult != 2, 1))
continue;
pr("%s standing by\n", prplane(&plane));
plane.pln_mission = 0;