the chance to "try again" if the last time we were unsuccessful. Also, if a monster tries to find a path to the player (not directly reachable) and fails, mark all surrounding monsters of the same species within a radius of 2 as having been unsuccessful. This includes monsters that are currently out of los of the player or that are targetting a different monster. Once they target the player, there'll either be a direct path which they can use, or there won't, in which case there's a low chance of using path finding; otherwise they'll simply advance the traditional way as close as they can get.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5733 c06c8d41-db1a-0410-9941-cceddc491573
SXUKGEXMGRRN6UO2GJW4HSVU5TSUNUHIHBMMF7CAG7QMLKZYWTKQC
7ZOJ5EJYOASGTVLEK7SG344TBZWYOIFSXCZAECN3HGN7TLTMV5BQC
LH4OYDEWEON5QNUCM74R7MNBJDP7O4XRETY74ZMYSXUXYQV427PAC
UEI5JAVCMN7Y2SACTEZPZSNFJWOJTC55G24Q6LKQCT4XNDH5ZQIAC
PEXHYCLRKDG2PVOJ3DDCMUZUK2HTSPU5WKH4MODFL4FTBQRQTY5QC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
ECSAD7JJSOUJBCG2SA2R64YJWIGDDP6NHDX5QINBN75VTYDPVZSAC
WT66JDIRTLLP37SHTV4GI3V64JFJ4D25LNRLGCHFG6CLEFKJ3QGQC
PFEJ4LMDNEKLMGRCMWQ7EIRVU4JMYGICI4G7X4WVWOROVXQCBZ7QC
LFBNFE3PZBXTR2ROPKYPARUWLJAYWAKGTS7VBWADZWVVSJ5CLX6AC
3WHI3KM43ZCN4ITJLFQQBQBC4OJPRS7QTBPIQ6QBCUVKRSK476SAC
5BJPWUPLJFS34FUTFJVKA4A52YMIGV6EWDXLNSDCWBJWBGVSQFGQC
UET576SVCGS2TXEDRTO7BUTOTLJ77MYHIVZJCDWGH2BAXYMKG6DAC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
RX6575DZOHRUXQUZH34YZGPZJF4STUPLBQDIVTINA2L6LVCKRIGQC
// If a monster can see but not directly reach the player, and then fails to
// find a path to get him, mark all surrounding (in a radius of 2) monsters
// of the same species as also being unable to find a path, so we won't need
// to calculate again.
// Should there be a direct path to the player for a monster thus marked, it
// will still be able to come nearer (and the mark will be cleared).
static void _mark_species_members_player_unreachable(monsters *mon)
{
// Highly intelligent monsters are capable of pathfinding and don't
// need their neighbour's advice.
if (mons_intel(mon->type) > I_NORMAL)
return;
// We won't be able to find pack members of human unique monsters.
if (mons_is_unique(mon->type) && mons_species(mon->type) == MONS_HUMAN)
return;
int x, y;
monsters *m;
for (int i = -2; i <= 2; i++)
for (int j = -2; j <= 2; j++)
{
if (i == 0 && j == 0)
continue;
x = mon->x + i;
y = mon->y + j;
if (!in_bounds(x,y))
continue;
if (mgrd[x][y] == NON_MONSTER)
continue;
// Don't alert monsters out of sight (e.g. on the other side of
// a wall).
if (!mon->mon_see_grid(x, y))
continue;
m = &menv[mgrd[x][y]];
// Only mark target for monsters of same species.
// Restrict to same _type_ for humans (by far the most
// versatile species).
if (mon->type != m->type
&& (mon->type == MONS_HUMAN
|| mons_species(mon->type) != mons_species(m->type)))
{
continue;
}
if (m->travel_target == MTRAV_NONE)
m->travel_target = MTRAV_UNREACHABLE;
}
}
offer_corpse(delay.parm1);
StashTrack.update_stash(); // Don't stash-track this corpse anymore.
if (food_is_rotten(mitm[delay.parm1]))
{
simple_god_message(coinflip() ? " refuses to accept that"
" mouldy sacrifice!"
: " demands fresh blood!",
you.religion);
_pop_delay();
// Chain onto the next delay.
handle_delay();
}
else
{
offer_corpse(delay.parm1);
StashTrack.update_stash(); // Don't stash-track this corpse anymore.
}