Sectors already spotted overflying planes in every sector along the
flight path, but ships and land units did that only in the target
sector, once if you got any ships there, in ac_encounter(), once if
you got any land units there, in ac_encounter(), once for ships firing
flak, in ac_shipflak(), and once for land units firing flak, in
ac_landflak(). Remove all that, and generalize ac_encounter()'s code
for sectors to spot planes to include ships and land units. Unlike
before, ships and land units don't spot allied planes.
evaded = do_evade(bomb_list, esc_list);
if (!evaded) {
evaded = do_evade(bomb_list, esc_list);
if (!evaded) {
- if (sect.sct_own != 0 && sect.sct_own != plane_owner
- && rel[sect.sct_own] != ALLIED) {
- overfly[sect.sct_own]++;
- PR(sect.sct_own, "%s planes spotted over %s\n",
- cname(plane_owner), xyas(x, y, sect.sct_own));
+ overfly[sect.sct_own]++;
+ for (cn = 1; cn < MAXNOC; cn++) {
+ if (cn == plane_owner || rel[cn] == ALLIED)
+ continue;
+ if (cn != sect.sct_own && !gotships[cn] && !gotlands[cn])
+ continue;
+ PR(cn, "%s planes spotted over %s\n",
+ cname(plane_owner), xyas(x, y, cn));
- setcont(sect.sct_own, plane_owner, FOUND_FLY);
+ setcont(cn, plane_owner, FOUND_FLY);
for (cn = 1; cn < MAXNOC; cn++) {
if (plane_owner == cn)
continue;
for (cn = 1; cn < MAXNOC; cn++) {
if (plane_owner == cn)
continue;
+ if (overfly[cn] > 0 && rel[cn] != ALLIED)
nreport(plane_owner, N_OVFLY_SECT, cn, overfly[cn]);
}
/* If the map changed, update it */
nreport(plane_owner, N_OVFLY_SECT, cn, overfly[cn]);
}
/* If the map changed, update it */
for (cn = 1; cn < MAXNOC && !QEMPTY(bomb_list); cn++) {
if (plane_owner == cn)
continue;
for (cn = 1; cn < MAXNOC && !QEMPTY(bomb_list); cn++) {
if (plane_owner == cn)
continue;
- if (gotships[cn] != 0)
- PR(cn, "%s planes spotted over ships in %s\n",
- cname(plane_owner), xyas(x, y, cn));
- if (gotlands[cn] != 0)
- PR(cn, "%s planes spotted over land units in %s\n",
- cname(plane_owner), xyas(x, y, cn));
if (gotships[cn] || gotlands[cn]) {
if (gotships[cn] || gotlands[cn]) {
- if (opt_HIDDEN)
- setcont(cn, plane_owner, FOUND_FLY);
if (rel[cn] <= HOSTILE && !evaded) {
if (!gotilist[cn]) {
getilist(&ilist[cn], cn);
if (rel[cn] <= HOSTILE && !evaded) {
if (!gotilist[cn]) {
getilist(&ilist[cn], cn);
struct plist *plp;
natid plane_owner;
natid from;
struct plist *plp;
natid plane_owner;
natid from;
plp = (struct plist *)list->q_forw;
plane_owner = plp->plane.pln_own;
plp = (struct plist *)list->q_forw;
plane_owner = plp->plane.pln_own;
- memset(nats, 0, sizeof(nats));
total = ngun = 0;
snxtitem_xy(&ni, EF_SHIP, x, y);
while (!QEMPTY(list) && nxtitem(&ni, &ship)) {
total = ngun = 0;
snxtitem_xy(&ni, EF_SHIP, x, y);
while (!QEMPTY(list) && nxtitem(&ni, &ship)) {
ngun += flak;
total += techfact(ship.shp_tech, flak * 2.0);
ngun += flak;
total += techfact(ship.shp_tech, flak * 2.0);
- if (!nats[ship.shp_own]) {
- /* First time here, print the message */
- PR(ship.shp_own, "%s planes spotted over ships in %s\n",
- cname(plane_owner), xyas(x, y, ship.shp_own));
- nats[ship.shp_own] = 1;
- }
PR(ship.shp_own, "firing %.0f flak guns from %s...\n",
flak, prship(&ship));
from = ship.shp_own;
PR(ship.shp_own, "firing %.0f flak guns from %s...\n",
flak, prship(&ship));
from = ship.shp_own;
struct plist *plp;
natid plane_owner;
natid from;
struct plist *plp;
natid plane_owner;
natid from;
plp = (struct plist *)list->q_forw;
plane_owner = plp->plane.pln_own;
plp = (struct plist *)list->q_forw;
plane_owner = plp->plane.pln_own;
- memset(nats, 0, sizeof(nats));
total = ngun = 0;
snxtitem_xy(&ni, EF_LAND, x, y);
while (!QEMPTY(list) && nxtitem(&ni, &land)) {
total = ngun = 0;
snxtitem_xy(&ni, EF_LAND, x, y);
while (!QEMPTY(list) && nxtitem(&ni, &land)) {
ngun += flak;
total += techfact(land.lnd_tech, flak * 2.0);
ngun += flak;
total += techfact(land.lnd_tech, flak * 2.0);
- if (!nats[land.lnd_own]) {
- /* First time here, print the message */
- PR(land.lnd_own, "%s planes spotted over land units in %s\n",
- cname(plane_owner), xyas(x, y, land.lnd_own));
- nats[land.lnd_own] = 1;
- }
PR(land.lnd_own, "firing flak guns from unit %s (aa rating %d)\n",
prland(&land), aaf);
from = land.lnd_own;
PR(land.lnd_own, "firing flak guns from unit %s (aa rating %d)\n",
prland(&land), aaf);
from = land.lnd_own;