Make spy command require sector military
Spies shot were only deduced from sector military; land units were immune to losses; in fact they needn't have any military to spy. Fix by requiring and using only sector military. Closes #758483.
This commit is contained in:
parent
ab2b930b5b
commit
3735f04b73
1 changed files with 10 additions and 16 deletions
|
@ -62,13 +62,11 @@ spy(void)
|
||||||
coord x, y;
|
coord x, y;
|
||||||
coord nx, ny;
|
coord nx, ny;
|
||||||
int military;
|
int military;
|
||||||
int savemil;
|
|
||||||
int btucost;
|
int btucost;
|
||||||
int i;
|
int i;
|
||||||
coord *table; /* sectors already seen */
|
coord *table; /* sectors already seen */
|
||||||
int t_len = 0;
|
int t_len = 0;
|
||||||
int nrecon;
|
int nrecon;
|
||||||
int nunits;
|
|
||||||
struct nstr_sect nstr;
|
struct nstr_sect nstr;
|
||||||
struct nstr_item ni;
|
struct nstr_item ni;
|
||||||
struct natstr *natp;
|
struct natstr *natp;
|
||||||
|
@ -103,27 +101,25 @@ spy(void)
|
||||||
while (nxtsct(&nstr, &from)) {
|
while (nxtsct(&nstr, &from)) {
|
||||||
if (!player->owner && !player->god)
|
if (!player->owner && !player->god)
|
||||||
continue;
|
continue;
|
||||||
nrecon = 0;
|
military = from.sct_item[I_MILIT];
|
||||||
nunits = 0;
|
if (military == 0)
|
||||||
snxtitem_xy(&ni, EF_LAND, from.sct_x, from.sct_y);
|
|
||||||
while (nxtitem(&ni, &land)) {
|
|
||||||
nunits++;
|
|
||||||
if (lchr[(int)land.lnd_type].l_flags & L_RECON)
|
|
||||||
nrecon++;
|
|
||||||
}
|
|
||||||
if ((military = from.sct_item[I_MILIT]) == 0 && (nunits == 0))
|
|
||||||
continue;
|
continue;
|
||||||
x = from.sct_x;
|
x = from.sct_x;
|
||||||
y = from.sct_y;
|
y = from.sct_y;
|
||||||
|
nrecon = 0;
|
||||||
|
snxtitem_xy(&ni, EF_LAND, x, y);
|
||||||
|
while (nxtitem(&ni, &land)) {
|
||||||
|
if (lchr[(int)land.lnd_type].l_flags & L_RECON)
|
||||||
|
nrecon++;
|
||||||
|
}
|
||||||
/* Print out the units/planes in this sector */
|
/* Print out the units/planes in this sector */
|
||||||
prunits(x, y);
|
prunits(x, y);
|
||||||
prplanes(x, y);
|
prplanes(x, y);
|
||||||
savemil = military;
|
|
||||||
/*
|
/*
|
||||||
* check the neighboring sectors.
|
* check the neighboring sectors.
|
||||||
*/
|
*/
|
||||||
for (i = 1; i <= 6; i++) {
|
for (i = 1; i <= 6; i++) {
|
||||||
if ((military == 0) && (nunits == 0))
|
if (military == 0)
|
||||||
break;
|
break;
|
||||||
nx = x + diroff[i][0];
|
nx = x + diroff[i][0];
|
||||||
ny = y + diroff[i][1];
|
ny = y + diroff[i][1];
|
||||||
|
@ -177,9 +173,7 @@ spy(void)
|
||||||
setcont(player->cnum, own, FOUND_SPY);
|
setcont(player->cnum, own, FOUND_SPY);
|
||||||
}
|
}
|
||||||
/* subtract any military if necessary */
|
/* subtract any military if necessary */
|
||||||
if ((savemil != military) && (savemil > 0)) {
|
if (from.sct_item[I_MILIT] != military) {
|
||||||
if ((military < 0) || (military > savemil))
|
|
||||||
military = 0;
|
|
||||||
from.sct_item[I_MILIT] = military;
|
from.sct_item[I_MILIT] = military;
|
||||||
putsect(&from);
|
putsect(&from);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue