Just one caller wants them. Inline that call, and simplify the
others.
extern int pln_oneway_to_carrier_ok(struct emp_qelem *,
struct emp_qelem *, int);
extern void pln_newlanding(struct emp_qelem *, coord, coord, int);
extern int pln_oneway_to_carrier_ok(struct emp_qelem *,
struct emp_qelem *, int);
extern void pln_newlanding(struct emp_qelem *, coord, coord, int);
-extern int could_be_on_ship(struct plnstr *, struct shpstr *,
- int, int, int, int);
+extern int could_be_on_ship(struct plnstr *, struct shpstr *);
extern int put_plane_on_ship(struct plnstr *, struct shpstr *);
extern void pln_dropoff(struct emp_qelem *, struct ichrstr *,
coord, coord, int);
extern int put_plane_on_ship(struct plnstr *, struct shpstr *);
extern void pln_dropoff(struct emp_qelem *, struct ichrstr *,
coord, coord, int);
* David Sharnoff, 1987
* Ken Stevens, 1995 (rewritten)
* Steve McClure, 1998-2000
* David Sharnoff, 1987
* Ken Stevens, 1995 (rewritten)
* Steve McClure, 1998-2000
- * Markus Armbruster, 2004-2011
+ * Markus Armbruster, 2004-2012
} else if (sp->shp_x != pln.pln_x || sp->shp_y != pln.pln_y)
continue;
} else if (sp->shp_x != pln.pln_x || sp->shp_y != pln.pln_y)
continue;
- if (!could_be_on_ship(&pln, sp, 0, 0, 0, 0)) {
+ if (!could_be_on_ship(&pln, sp)) {
if (noisy) {
if (plchr[(int)pln.pln_type].pl_flags & P_K)
p = "choppers";
if (noisy) {
if (plchr[(int)pln.pln_type].pl_flags & P_K)
p = "choppers";
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
plp = (struct plist *)qp;
if (cno >= 0) {
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
plp = (struct plist *)qp;
if (cno >= 0) {
- if (!could_be_on_ship(&plp->plane, &ship, 0, 0, 0, 0))
+ if (!could_be_on_ship(&plp->plane, &ship))
pr("\t%s cannot land on ship #%d! %s aborts!\n",
prplane(&plp->plane), cno, prplane(&plp->plane));
else if (!put_plane_on_ship(&plp->plane, &ship))
pr("\t%s cannot land on ship #%d! %s aborts!\n",
prplane(&plp->plane), cno, prplane(&plp->plane));
else if (!put_plane_on_ship(&plp->plane, &ship))
/*
* Can PP be loaded on a ship of SP's type?
/*
* Can PP be loaded on a ship of SP's type?
- * Assume that it already carries N planes, of which NCH are choppers,
- * NXL xlight, NMSL light missiles, and the rest are light fixed-wing
- * planes.
-could_be_on_ship(struct plnstr *pp, struct shpstr *sp,
- int n, int nch, int nxl, int nmsl)
+could_be_on_ship(struct plnstr *pp, struct shpstr *sp)
+ int nch = 0, nxl = 0, nmsl = 0;
+
if (!inc_shp_nplane(pp, &nch, &nxl, &nmsl))
return 0;
if (!inc_shp_nplane(pp, &nch, &nxl, &nmsl))
return 0;
-
- return ship_can_carry(sp, n + 1, nch, nxl, nmsl);
+ return ship_can_carry(sp, 1, nch, nxl, nmsl);
return 1; /* Already on ship */
n = shp_nplane(ship, &nch, &nxl, &nmsl);
return 1; /* Already on ship */
n = shp_nplane(ship, &nch, &nxl, &nmsl);
- if (!could_be_on_ship(plane, ship, n, nch, nxl, nmsl))
- return 0;
+ if (!inc_shp_nplane(plane, &nch, &nxl, &nmsl))
+ return 0; /* not a carrier plane */
+ if (!ship_can_carry(ship, n + 1, nch, nxl, nmsl))
+ return 0; /* no space */
plane->pln_x = ship->shp_x;
plane->pln_y = ship->shp_y;
plane->pln_x = ship->shp_x;
plane->pln_y = ship->shp_y;