Change when planes spot ships and land units
Planes now spot ships and land units only when flying recon or sweep, and along all of their flight path instead of just the target sector. It still takes a spy plane to identify ships and land units. Before, non-spy planes spotted ships and land units only in the target sector, regardless of type of sortie, once for all ships and land units, in ac_encounter(), once for ships firing flak, in ac_shipflak(), and once for land units firing flak, in ac_landflak(). Remove all that.
This commit is contained in:
parent
831bd63071
commit
2ab91d8b6b
1 changed files with 31 additions and 31 deletions
|
@ -74,8 +74,8 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
int dir;
|
int dir;
|
||||||
int nats[MAXNOC];
|
unsigned char gotships[MAXNOC];
|
||||||
int lnats[MAXNOC];
|
unsigned char gotlands[MAXNOC];
|
||||||
int gotilist[MAXNOC];
|
int gotilist[MAXNOC];
|
||||||
unsigned char rel[MAXNOC];
|
unsigned char rel[MAXNOC];
|
||||||
int overfly[MAXNOC];
|
int overfly[MAXNOC];
|
||||||
|
@ -120,6 +120,20 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
getsect(x, y, §);
|
getsect(x, y, §);
|
||||||
|
memset(gotships, 0, sizeof(gotships));
|
||||||
|
snxtitem_xy(&ni, EF_SHIP, x, y);
|
||||||
|
while (nxtitem(&ni, &ship)) {
|
||||||
|
if (mchr[(int)ship.shp_type].m_flags & M_SUB)
|
||||||
|
continue;
|
||||||
|
gotships[ship.shp_own] = 1;
|
||||||
|
}
|
||||||
|
memset(gotlands, 0, sizeof(gotlands));
|
||||||
|
snxtitem_xy(&ni, EF_LAND, x, y);
|
||||||
|
while (nxtitem(&ni, &land)) {
|
||||||
|
if (land.lnd_ship >= 0 || land.lnd_land >= 0)
|
||||||
|
continue;
|
||||||
|
gotlands[land.lnd_own] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (mission_flags & PM_R) {
|
if (mission_flags & PM_R) {
|
||||||
flags = plane_caps(bomb_list);
|
flags = plane_caps(bomb_list);
|
||||||
|
@ -169,6 +183,18 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
|
||||||
}
|
}
|
||||||
if (flags & P_S)
|
if (flags & P_S)
|
||||||
satdisp_units(sect.sct_x, sect.sct_y);
|
satdisp_units(sect.sct_x, sect.sct_y);
|
||||||
|
else {
|
||||||
|
for (cn = 1; cn < MAXNOC; cn++) {
|
||||||
|
if (cn == plane_owner)
|
||||||
|
continue;
|
||||||
|
if (gotships[cn])
|
||||||
|
PR(plane_owner, "Flying over %s ships in %s\n",
|
||||||
|
cname(cn), xyas(x, y, plane_owner));
|
||||||
|
if (gotlands[cn])
|
||||||
|
PR(plane_owner, "Flying over %s land units in %s\n",
|
||||||
|
cname(cn), xyas(x, y, plane_owner));
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
PR(plane_owner, "flying over %s at %s\n",
|
PR(plane_owner, "flying over %s at %s\n",
|
||||||
dchr[sect.sct_type].d_name, xyas(x, y, plane_owner));
|
dchr[sect.sct_type].d_name, xyas(x, y, plane_owner));
|
||||||
|
@ -234,40 +260,18 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* Something made it through */
|
/* Something made it through */
|
||||||
/* Go figure out if there are ships in this sector, and who's they are */
|
|
||||||
memset(nats, 0, sizeof(nats));
|
|
||||||
snxtitem_xy(&ni, EF_SHIP, x, y);
|
|
||||||
while (nxtitem(&ni, &ship)) {
|
|
||||||
if (mchr[(int)ship.shp_type].m_flags & M_SUB)
|
|
||||||
continue;
|
|
||||||
nats[ship.shp_own]++;
|
|
||||||
}
|
|
||||||
/* Go figure out if there are units in this sector, and who's they are */
|
|
||||||
memset(lnats, 0, sizeof(lnats));
|
|
||||||
snxtitem_xy(&ni, EF_LAND, x, y);
|
|
||||||
while (nxtitem(&ni, &land)) {
|
|
||||||
if (land.lnd_ship >= 0 || land.lnd_land >= 0)
|
|
||||||
continue;
|
|
||||||
lnats[land.lnd_own]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now, let's make life a little rougher. */
|
/* Now, let's make life a little rougher. */
|
||||||
for (cn = 1; cn < MAXNOC && !QEMPTY(bomb_list); cn++) {
|
for (cn = 1; cn < MAXNOC && !QEMPTY(bomb_list); cn++) {
|
||||||
if (plane_owner == cn)
|
if (plane_owner == cn)
|
||||||
continue;
|
continue;
|
||||||
if (nats[cn] != 0) {
|
if (gotships[cn] != 0)
|
||||||
PR(plane_owner, "Flying over %s ships in %s\n",
|
|
||||||
cname(cn), xyas(x, y, plane_owner));
|
|
||||||
PR(cn, "%s planes spotted over ships in %s\n",
|
PR(cn, "%s planes spotted over ships in %s\n",
|
||||||
cname(plane_owner), xyas(x, y, cn));
|
cname(plane_owner), xyas(x, y, cn));
|
||||||
}
|
if (gotlands[cn] != 0)
|
||||||
if (lnats[cn] != 0) {
|
|
||||||
PR(plane_owner, "Flying over %s land units in %s\n",
|
|
||||||
cname(cn), xyas(x, y, plane_owner));
|
|
||||||
PR(cn, "%s planes spotted over land units in %s\n",
|
PR(cn, "%s planes spotted over land units in %s\n",
|
||||||
cname(plane_owner), xyas(x, y, cn));
|
cname(plane_owner), xyas(x, y, cn));
|
||||||
}
|
if (gotships[cn] || gotlands[cn]) {
|
||||||
if (nats[cn] || lnats[cn]) {
|
|
||||||
if (opt_HIDDEN)
|
if (opt_HIDDEN)
|
||||||
setcont(cn, plane_owner, FOUND_FLY);
|
setcont(cn, plane_owner, FOUND_FLY);
|
||||||
if (rel[cn] <= HOSTILE && !evaded) {
|
if (rel[cn] <= HOSTILE && !evaded) {
|
||||||
|
@ -741,8 +745,6 @@ ac_shipflak(struct emp_qelem *list, coord x, coord y)
|
||||||
/* First time here, print the message */
|
/* First time here, print the message */
|
||||||
PR(ship.shp_own, "%s planes spotted over ships in %s\n",
|
PR(ship.shp_own, "%s planes spotted over ships in %s\n",
|
||||||
cname(plane_owner), xyas(x, y, ship.shp_own));
|
cname(plane_owner), xyas(x, y, ship.shp_own));
|
||||||
PR(plane_owner, "Flying over %s ships in %s\n",
|
|
||||||
cname(ship.shp_own), xyas(x, y, plane_owner));
|
|
||||||
nats[ship.shp_own] = 1;
|
nats[ship.shp_own] = 1;
|
||||||
}
|
}
|
||||||
PR(ship.shp_own, "firing %.0f flak guns from %s...\n",
|
PR(ship.shp_own, "firing %.0f flak guns from %s...\n",
|
||||||
|
@ -801,8 +803,6 @@ ac_landflak(struct emp_qelem *list, coord x, coord y)
|
||||||
/* First time here, print the message */
|
/* First time here, print the message */
|
||||||
PR(land.lnd_own, "%s planes spotted over land units in %s\n",
|
PR(land.lnd_own, "%s planes spotted over land units in %s\n",
|
||||||
cname(plane_owner), xyas(x, y, land.lnd_own));
|
cname(plane_owner), xyas(x, y, land.lnd_own));
|
||||||
PR(plane_owner, "Flying over %s land units in %s\n",
|
|
||||||
cname(land.lnd_own), xyas(x, y, plane_owner));
|
|
||||||
nats[land.lnd_own] = 1;
|
nats[land.lnd_own] = 1;
|
||||||
}
|
}
|
||||||
PR(land.lnd_own, "firing flak guns from unit %s (aa rating %d)\n",
|
PR(land.lnd_own, "firing flak guns from unit %s (aa rating %d)\n",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue