Restrict ac_encounter() mission_flags to current player
The only user is reco(), so the restriction is fine. Several functions called on behalf of mission_flags assumed it already: plane_sweep(), sathead(), satdisp_sect(), satdisp_units(). Simplify the rest accordingly: plane_sona() and ac_encounter() itself.
This commit is contained in:
parent
e25413a688
commit
2cfb124b6c
2 changed files with 38 additions and 38 deletions
|
@ -272,8 +272,7 @@ plane_sona(struct emp_qelem *plane_list, int x, int y,
|
||||||
continue;
|
continue;
|
||||||
add_shiplist(targ->shp_uid, head);
|
add_shiplist(targ->shp_uid, head);
|
||||||
if (!found) {
|
if (!found) {
|
||||||
mpr(pp->pln_own,
|
pr("\nSonar contact in %s\n", xyas(x, y, player->cnum));
|
||||||
"\nSonar contact in %s\n", xyas(x, y, pp->pln_own));
|
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
if (getrel(getnatp(targ->shp_own), pp->pln_own) < FRIENDLY &&
|
if (getrel(getnatp(targ->shp_own), pp->pln_own) < FRIENDLY &&
|
||||||
|
@ -281,16 +280,14 @@ plane_sona(struct emp_qelem *plane_list, int x, int y,
|
||||||
EF_SHIP))
|
EF_SHIP))
|
||||||
if (roll(100) > pln_identchance(pp, shp_hardtarget(targ),
|
if (roll(100) > pln_identchance(pp, shp_hardtarget(targ),
|
||||||
EF_SHIP))
|
EF_SHIP))
|
||||||
mpr(pp->pln_own, "sub #%d %s\n", targ->shp_uid,
|
pr("sub #%d %s\n", targ->shp_uid,
|
||||||
xyas(targ->shp_x, targ->shp_y, pp->pln_own));
|
xyas(targ->shp_x, targ->shp_y, player->cnum));
|
||||||
else
|
else
|
||||||
mpr(pp->pln_own, "%s %s\n",
|
pr("%s %s\n", prship(targ),
|
||||||
prship(targ),
|
xyas(targ->shp_x, targ->shp_y, player->cnum));
|
||||||
xyas(targ->shp_x, targ->shp_y, pp->pln_own));
|
|
||||||
else
|
else
|
||||||
mpr(pp->pln_own, "%s %s @ %s\n",
|
pr("%s %s @ %s\n", cname(targ->shp_own), prship(targ),
|
||||||
cname(targ->shp_own), prship(targ),
|
xyas(targ->shp_x, targ->shp_y, player->cnum));
|
||||||
xyas(targ->shp_x, targ->shp_y, pp->pln_own));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,17 +104,20 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
|
||||||
memset(overfly, 0, sizeof(overfly));
|
memset(overfly, 0, sizeof(overfly));
|
||||||
getilists(ilist, rel, plane_owner);
|
getilists(ilist, rel, plane_owner);
|
||||||
|
|
||||||
|
if (CANT_HAPPEN(mission_flags && plane_owner != player->cnum))
|
||||||
|
mission_flags = 0;
|
||||||
|
|
||||||
if (mission_flags & PM_R) {
|
if (mission_flags & PM_R) {
|
||||||
flags = pln_caps(bomb_list);
|
flags = pln_caps(bomb_list);
|
||||||
if (flags & P_S) {
|
if (flags & P_S) {
|
||||||
PR(plane_owner, "\nSPY Plane report\n");
|
pr("\nSPY Plane report\n");
|
||||||
PRdate(plane_owner);
|
prdate();
|
||||||
sathead();
|
sathead();
|
||||||
} else if (flags & P_A) {
|
} else if (flags & P_A) {
|
||||||
PR(plane_owner, "\nAnti-Sub Patrol report\n");
|
pr("\nAnti-Sub Patrol report\n");
|
||||||
} else {
|
} else {
|
||||||
PR(plane_owner, "\nReconnaissance report\n");
|
pr("\nReconnaissance report\n");
|
||||||
PRdate(plane_owner);
|
prdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,61 +141,61 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
|
||||||
if (mission_flags & PM_R) {
|
if (mission_flags & PM_R) {
|
||||||
flags = pln_caps(bomb_list);
|
flags = pln_caps(bomb_list);
|
||||||
if (opt_HIDDEN)
|
if (opt_HIDDEN)
|
||||||
setcont(plane_owner, sect.sct_own, FOUND_FLY);
|
setcont(player->cnum, sect.sct_own, FOUND_FLY);
|
||||||
if (sect.sct_type == SCT_WATER) {
|
if (sect.sct_type == SCT_WATER) {
|
||||||
PR(plane_owner, "flying over %s at %s\n",
|
pr("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, player->cnum));
|
||||||
if (mission_flags & PM_S)
|
if (mission_flags & PM_S)
|
||||||
plane_sweep(bomb_list, x, y);
|
plane_sweep(bomb_list, x, y);
|
||||||
if (flags & P_A)
|
if (flags & P_A)
|
||||||
plane_sona(bomb_list, x, y, &head);
|
plane_sona(bomb_list, x, y, &head);
|
||||||
changed += map_set(plane_owner,
|
changed += map_set(player->cnum,
|
||||||
sect.sct_x, sect.sct_y,
|
sect.sct_x, sect.sct_y,
|
||||||
dchr[sect.sct_type].d_mnem, 0);
|
dchr[sect.sct_type].d_mnem, 0);
|
||||||
} else if (flags & P_S) {
|
} else if (flags & P_S) {
|
||||||
satdisp_sect(§, flags & P_I ? 10 : 50);
|
satdisp_sect(§, flags & P_I ? 10 : 50);
|
||||||
} else {
|
} else {
|
||||||
/* This is borrowed from lookout */
|
/* This is borrowed from lookout */
|
||||||
if (sect.sct_own == plane_owner)
|
if (sect.sct_own == player->cnum)
|
||||||
PR(plane_owner, "Your ");
|
pr("Your ");
|
||||||
else
|
else
|
||||||
PR(plane_owner, "%s (#%d) ",
|
pr("%s (#%d) ",
|
||||||
cname(sect.sct_own), sect.sct_own);
|
cname(sect.sct_own), sect.sct_own);
|
||||||
PR(plane_owner, "%s", dchr[sect.sct_type].d_name);
|
pr("%s", dchr[sect.sct_type].d_name);
|
||||||
changed += map_set(plane_owner,
|
changed += map_set(player->cnum,
|
||||||
sect.sct_x, sect.sct_y,
|
sect.sct_x, sect.sct_y,
|
||||||
dchr[sect.sct_type].d_mnem, 0);
|
dchr[sect.sct_type].d_mnem, 0);
|
||||||
PR(plane_owner, " %d%% efficient ",
|
pr(" %d%% efficient ",
|
||||||
(sect.sct_own == plane_owner) ?
|
(sect.sct_own == player->cnum) ?
|
||||||
sect.sct_effic : roundintby((int)sect.sct_effic, 25));
|
sect.sct_effic : roundintby((int)sect.sct_effic, 25));
|
||||||
civ = sect.sct_item[I_CIVIL];
|
civ = sect.sct_item[I_CIVIL];
|
||||||
mil = sect.sct_item[I_MILIT];
|
mil = sect.sct_item[I_MILIT];
|
||||||
if (civ)
|
if (civ)
|
||||||
PR(plane_owner, "with %s%d civ ",
|
pr("with %s%d civ ",
|
||||||
(sect.sct_own == plane_owner) ?
|
(sect.sct_own == player->cnum) ?
|
||||||
"" : "approx ",
|
"" : "approx ",
|
||||||
(sect.sct_own == plane_owner) ?
|
(sect.sct_own == player->cnum) ?
|
||||||
civ : roundintby(civ, 25));
|
civ : roundintby(civ, 25));
|
||||||
if (mil)
|
if (mil)
|
||||||
PR(plane_owner, "with %s%d mil ",
|
pr("with %s%d mil ",
|
||||||
(sect.sct_own == plane_owner) ?
|
(sect.sct_own == player->cnum) ?
|
||||||
"" : "approx ",
|
"" : "approx ",
|
||||||
(sect.sct_own == plane_owner) ?
|
(sect.sct_own == player->cnum) ?
|
||||||
mil : roundintby(mil, 25));
|
mil : roundintby(mil, 25));
|
||||||
PR(plane_owner, "@ %s\n", xyas(x, y, plane_owner));
|
pr("@ %s\n", xyas(x, y, player->cnum));
|
||||||
}
|
}
|
||||||
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 {
|
else {
|
||||||
for (cn = 1; cn < MAXNOC; cn++) {
|
for (cn = 1; cn < MAXNOC; cn++) {
|
||||||
if (cn == plane_owner)
|
if (cn == player->cnum)
|
||||||
continue;
|
continue;
|
||||||
if (gotships[cn])
|
if (gotships[cn])
|
||||||
PR(plane_owner, "Flying over %s ships in %s\n",
|
pr("Flying over %s ships in %s\n",
|
||||||
cname(cn), xyas(x, y, plane_owner));
|
cname(cn), xyas(x, y, player->cnum));
|
||||||
if (gotlands[cn])
|
if (gotlands[cn])
|
||||||
PR(plane_owner, "Flying over %s land units in %s\n",
|
pr("Flying over %s land units in %s\n",
|
||||||
cname(cn), xyas(x, y, plane_owner));
|
cname(cn), xyas(x, y, player->cnum));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue