Remove columns lnd, pln from spy report to fix spy unit leak
The values in these columns were computed by count_sect_units() and count_sect_planes(), which included land units and planes in the count that aren't shown by prunits() and prplanes(), namely own and embarked units. Confusing. Moreover, count_sect_planes() and prunits() rolled dice separately for spy units. This could leak the presence of spies even when prunits() didn't show them. All fixable, but not worth the trouble; just remove the counts.
This commit is contained in:
parent
c658d1e08d
commit
a233ecfea9
5 changed files with 4 additions and 56 deletions
|
@ -216,7 +216,7 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
|
|||
* defending unit.. find a place to send it
|
||||
* strategy: look for the most-populated
|
||||
* adjacent sector that is owned by the unit
|
||||
* player->owner. Charge mob..
|
||||
* owner. Charge mob..
|
||||
*/
|
||||
biggest = -1;
|
||||
nowned = 0;
|
||||
|
@ -386,34 +386,6 @@ intelligence_report(int destination, struct lndstr *lp, int spy,
|
|||
}
|
||||
}
|
||||
|
||||
/* Used by the spy command to count land units in a sector. If used
|
||||
for anything else, you may want to reconsider, because this doesn't
|
||||
always count spies. :) */
|
||||
int
|
||||
count_sect_units(struct sctstr *sp)
|
||||
{
|
||||
int count = 0;
|
||||
struct nstr_item ni;
|
||||
struct lndstr land;
|
||||
|
||||
snxtitem_all(&ni, EF_LAND);
|
||||
while (nxtitem(&ni, &land)) {
|
||||
if (!land.lnd_own)
|
||||
continue;
|
||||
if (land.lnd_x != sp->sct_x || land.lnd_y != sp->sct_y)
|
||||
continue;
|
||||
/* Don't always see spies */
|
||||
if (lchr[(int)land.lnd_type].l_flags & L_SPY) {
|
||||
if (!(chance(LND_SPY_DETECT_CHANCE(land.lnd_effic))))
|
||||
continue;
|
||||
}
|
||||
/* Got here, report it */
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void
|
||||
count_units(struct shpstr *sp)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue