exit.
Exits from bazaars are treated as rock stairs instead of stone stairs.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1952 c06c8d41-db1a-0410-9941-cceddc491573
PJ7HBIWAV3H23LXGZAAD2QYJ7HMOFOIR5ZJ4U2UTHI766LOTRRWQC
ZJU5Z2WDMI7HN4XJ3NVTVRHIZO2CGFUQ2FSKIRJVTQG47XHNCZFQC
GQL5SIGBHLU3FMCE54XVGLRY5AZHRM6DUEB722REA2DPLGJSN6EQC
SW3RLYFNRT3IJBK6LYKHKP2J2YDU7SXQWAJZX7U6S7ICYW43OMNQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
2WRXQTGYDBLV46WRNVIUKGNA5QS563XZNNW3N2L6PVOCHIP2YGHQC
EOMCPVNQLX3IMLC46EAO67DPBH5KEG2FQTPBLGU62HIRWA3UQ7XQC
FSD7GIK3YLZXWLEH37BU6KV3IUCFGXPQL6IZ7H65YWNRBEKDBX5AC
MSQI3TH6T62JAXQGLL52QZCWAMC372TGB6ZNNRDGUGMJKBNNV2VAC
CUNNC574MESEMTTONZ6YB6CJ2S5P6VA3V7Z3OODESWAK37GYOBPAC
R5JKQLY5QE6UBG3RH3Y5ZRSX6H35CHYI2HYNDZF6ZHVRULUORXBQC
56C44YMFHZ62GXAAOLYSLLGBVGRWXB53W2VI37Q26ZECEK2XG5SQC
}
}
// Checks if there is a square with the given mask within radius of pos.
static bool has_vault_in_radius(const coord_def &pos, int radius,
unsigned mask)
{
for (int yi = -radius; yi <= radius; ++yi)
{
for (int xi = -radius; xi <= radius; ++xi)
{
const coord_def p = pos + coord_def(xi, yi);
if (!in_bounds(p))
continue;
if (!unforbidden(p, mask))
return (true);
}
}
return (false);
}
// Find an entry point that's:
// * At least 25 squares away from the exit.
// * At least 4 squares away from the nearest vault.
// * Floor (well, obviously).
static coord_def labyrinth_find_entry_point(const dgn_region ®,
const coord_def &end)
{
const int min_distance = 25 * 25;
// Try many times.
for (int i = 0; i < 2000; ++i)
{
const coord_def place = reg.random_point();
if (grd(place) != DNGN_FLOOR)
continue;
if ((place - end).abs() < min_distance)
continue;
if (has_vault_in_radius(place, 4, MMT_VAULT))
continue;
return (place);
coord_def dgn_find_nearby_stair(int stair_to_find, bool find_closest)
static coord_def dgn_find_labyrinth_entry_point()
{
std::vector<map_marker*> markers = env_get_all_markers();
for (int i = 0, size = markers.size(); i < size; ++i)
{
map_marker *mark = markers[i];
if (mark->get_type() == MAT_FEATURE
&& dynamic_cast<map_feature_marker*>(mark)->feat
== DNGN_ENTER_LABYRINTH)
{
return (mark->pos);
}
}
return (coord_def());
}
coord_def dgn_find_nearby_stair(dungeon_feature_type stair_to_find,
bool find_closest)
if (stair_to_find == DNGN_ENTER_LABYRINTH)
{
const coord_def pos(dgn_find_labyrinth_entry_point());
if (in_bounds(pos))
return (pos);
// Couldn't find a good place, warn, and use old behaviour.
mpr("Oops, couldn't find labyrinth entry marker.", MSGCH_DIAGNOSTICS);
stair_to_find = DNGN_FLOOR;
}