(LND_SPY_DETECT_CHANCE): New.

(look_land, sabo, prunits, unitsatxy, lnd_mar_one_sector,
count_sect_units, takeover): Use it.  Closes bug#786369.
This commit is contained in:
Markus Armbruster 2003-11-09 12:52:16 +00:00
parent fc9ec1323a
commit c2c16e1a04
7 changed files with 10 additions and 19 deletions

View file

@ -258,7 +258,6 @@ look_land(register struct lndstr *lookland)
int i;
int dist;
double techfact(int, double);
double odds;
drange = techfact(lookland->lnd_tech, (double)lookland->lnd_spy);
drange = (drange * ((double)lookland->lnd_effic / 100.0));
@ -278,8 +277,7 @@ look_land(register struct lndstr *lookland)
enough not to be seen */
if (lp->lnd_ship >= 0 || lp->lnd_land >= 0)
continue;
odds = (double)(100 - lp->lnd_effic) + 0.10;
if (!(chance(odds)))
if (!(chance(LND_SPY_DETECT_CHANCE(lp->lnd_effic))))
continue;
}
vrange = ldround((double)((lp->lnd_vis * range) / 20.0), 1);

View file

@ -87,7 +87,7 @@ sabo(void)
}
putvar(V_SHELL, vec[I_SHELL] - 1, (s_char *)&land, EF_LAND);
odds = (100 - land.lnd_effic) / 100.0 + .10;
odds = LND_SPY_DETECT_CHANCE(land.lnd_effic);
if (chance(odds)) {
wu(0, sect.sct_own,
"%s spy shot in %s during sabotage attempt.\n",

View file

@ -281,7 +281,6 @@ prunits(int x, int y)
struct lndstr land;
struct nstr_item ni;
s_char report[128];
double odds;
snxtitem_xy(&ni, EF_LAND, x, y);
while (nxtitem(&ni, (s_char *)&land)) {
@ -291,8 +290,7 @@ prunits(int x, int y)
continue;
/* Don't always see spies */
if (lchr[(int)land.lnd_type].l_flags & L_SPY) {
odds = (double)(100 - land.lnd_effic) + 0.10;
if (!(chance(odds)))
if (!(chance(LND_SPY_DETECT_CHANCE(land.lnd_effic))))
continue;
}
if ((land.lnd_own != player->cnum) && land.lnd_own) {