extern double fortrange(struct sctstr *);
extern int roundrange(double);
/* list.c */
-extern int shipsatxy(coord, coord, int, int);
+extern int shipsatxy(coord, coord, int, int, int);
extern int carriersatxy(coord, coord, natid);
extern int unitsatxy(coord, coord, int, int);
extern int planesatxy(coord, coord, int, int);
effadv((int)target->sct_effic), dcp->d_name);
nsubs = 0;
plp = (struct plist *)list->q_forw;
+ nships = shipsatxy(target->sct_x, target->sct_y, 0, M_SUB, 0);
if (plp->pcp->pl_flags & P_A) {
- nships = num_shipsatxy(target->sct_x, target->sct_y, 0, 0);
- nsubs = nships - shipsatxy(target->sct_x, target->sct_y, 0, M_SUB);
+ nsubs = shipsatxy(target->sct_x, target->sct_y, M_SUB, 0, 1);
if (nsubs > 0)
pr("Some subs are present in the sector.\n");
- } else {
- nships = shipsatxy(target->sct_x, target->sct_y, 0, M_SUB);
}
nplanes = planesatxy(target->sct_x, target->sct_y, 0, 0);
nunits = unitsatxy(target->sct_x, target->sct_y, 0, 0);
nships = asw_shipsatxy(target->sct_x, target->sct_y, 0, 0,
&plp->plane, &head);
else
- nships = shipsatxy(target->sct_x, target->sct_y, 0, M_SUB);
+ nships = shipsatxy(target->sct_x, target->sct_y, 0, M_SUB, 0);
if (nships == 0) {
pr("%s could not find any ships!\n", prplane(&plp->plane));
continue;
if (plp->pcp->pl_flags & P_A)
print_shiplist(head);
else
- shipsatxy(target->sct_x, target->sct_y, 0, M_SUB);
+ shipsatxy(target->sct_x, target->sct_y, 0, M_SUB, 0);
continue;
}
if (*q == 'd')
#include "xy.h"
int
-shipsatxy(coord x, coord y, int wantflags, int nowantflags)
+shipsatxy(coord x, coord y, int wantflags, int nowantflags, int only_count)
{
int first;
int ships;
if (mp->m_flags & nowantflags)
continue;
}
- if (first) {
- pr(" # owner eff type\n");
- first = 0;
+ if (!only_count) {
+ if (first) {
+ pr(" # owner eff type\n");
+ first = 0;
+ }
+ pr("(#%3d) %10.10s %12.12s %s\n", ni.cur,
+ cname(ship.shp_own), effadv(ship.shp_effic), prship(&ship));
}
- pr("(#%3d) %10.10s %12.12s %s\n", ni.cur,
- cname(ship.shp_own), effadv(ship.shp_effic), prship(&ship));
ships++;
}
return ships;