grids where monsters might be lurking waiting to instakill you, as suggested by Kenneth Boyd. Tested in wizard mode (though not in a test game) and it works really well.
The code currently uses a #define flag, in case anyone wants to try both versions and compare, but I think it should either be replaced with a proper option or removed entirely. Either way, the new behaviour should be the default.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10759 c06c8d41-db1a-0410-9941-cceddc491573
JTQG4CMY6TPM4CHQN2KRIND2VPMQX535WGQ4AKKTGMDGP44UM3MQC
if (dest.origin())
#ifdef SAFE_EXPLORE
// Check whether this step puts us adjacent to any grid we haven't ever
// seen or any non-wall grid we cannot currently see.
//
// .tx Moving onto t puts us adjacent to an unseen grid.
// ?#@ --> Pick x instead.
// Only applies to diagonal moves.
if (RMODE_TRAVEL && move_x != 0 && move_y != 0)
{
coord_def unseen = coord_def();
for (adjacent_iterator ai(dest); ai; ++ai)
if (!see_grid(*ai)
&& (!is_terrain_seen(*ai) || !grid_is_wall(grd(*ai))))
{
unseen = *ai;
break;
}
if (unseen != coord_def())
{
// If so, try to use another adjacent grid that does
if (youpos.x == unseen.x)
new_dest.y = youpos.y;
else if (youpos.y == unseen.y)
new_dest.x = youpos.x;
// If the new grid cannot be entered, reset to dest.
if (!is_travelsafe_square(new_dest)
|| !is_traversable(grd(new_dest)))
{
new_dest = dest;
}
#ifdef DEBUG_SAFE_EXPLORE
mprf("youpos: (%d, %d), dest: (%d, %d), unseen: (%d, %d), "
"new_dest: (%d, %d)",
youpos.x, youpos.y, dest.x, dest.y, unseen.x, unseen.y,
new_dest.x, new_dest.y);
more();
#endif
}
}
#endif
if (new_dest.origin())