Also make sure melded equipment cannot corrode. (I'm still undecided about whether curses should affect melded items.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7383 c06c8d41-db1a-0410-9941-cceddc491573
PF6QKUU7AKP3X7NBR34O73PQ4BS2MWBMPD5MH5HOV2HLQFMA3PZQC
RYCGST674RRH2TASRIXJSBRVAC4K2VLWICKLKIPJJRUQZMRYLGBQC
EYH5LNJIH7HU6IV7DKA4ZRCFK7ZMUEOOPEH6EWG37TEUAJ5FSOQAC
XPTDBTPHD5CIPPOHIPMI7HBOTQIGGJPYKDOJCHWG2ZTI7SLUHTEAC
IP4A3VRYFYIVLRUAU4DF4KDNP6E4UISWJX3LI2F4EGSSMIJYRJXAC
SIDH2P7NBIG5KEOE27XHD3ZT2NQ2OJZFN6VZXWNWYFFY5YVXSSVQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
SRYIUTTRZYQDYPLLXYKEHMYWC4EGBYPOT65M2HZEIGFG6SDMV7SQC
7CMQLE4XIFMWDEUZAOKIKDW7BHAJCK5S26APMEZ6TEFEH63TEZ6AC
S34LKQDIQJLIWVIPASOJBBZ6ZCXDHP5KPS7TRBZJSCDRVNCLK6UAC
3BYA46OYLVN6ZPGAZD5OGIMMH5PRWGNSU3ITJRCVBE6P5HYYYAYQC
CIPVRZGLOZHCERK6YPOBV3P2E4IAB4H6D5EHLRQE2O5E4P4VCBUAC
K6S3LX4GPSVHOVIZVVGJDOMT6GXENOTXD6FM3ZHBN5GO4JA5E6YAC
PHBACPMH3F34GODHVDKNCMXWU373RJQGVTDLBFCCDLLWDXVYOLTAC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
HIRKGUMNJPWKSVTR6TVBPD3MWNA63CEHCLCIPWEMGDFHVB3NPLDQC
PJ7HBIWAV3H23LXGZAAD2QYJ7HMOFOIR5ZJ4U2UTHI766LOTRRWQC
// If in a labyrinth, always teleport well away from the centre.
// (Check done for the straight line, no pathfinding involved.)
bool need_distance_check = false;
coord_def centre;
if (you.level_type == LEVEL_LABYRINTH)
{
bool success = false;
for (int xpos = 0; xpos < GXM; xpos++)
{
for (int ypos = 0; ypos < GYM; ypos++)
{
centre = coord_def(xpos, ypos);
if (!in_bounds(centre))
continue;
// Checks whether a given grid has at least one neighbour surrounded
// entirely by non-floor.
static bool _has_no_floor_neighbours(const coord_def &pos, bool recurse = false)
{
for (int x = -1; x <= 1; x++)
for (int y = -1; y <= 1; y++)
{
if (x == 0 && y == 0)
continue;
const coord_def p = pos + coord_def(x, y);
if (!in_bounds(p))
return (true);
if (recurse)
{
if (grd(p) == DNGN_FLOOR)
return (false);
}
else if (_has_no_floor_neighbours(p, true))
return (true);
}
return (recurse);
}
// Change the borders of the labyrinth to another (undiggable) wall type.
static void _change_labyrinth_border(const dgn_region ®ion,
const dungeon_feature_type wall)
{
const coord_def &end = region.pos + region.size;
for (int y = region.pos.y-1; y <= end.y; ++y)
for (int x = region.pos.x-1; x <= end.x; ++x)
{
const coord_def c(x, y);
if (!in_bounds(c)) // paranoia
continue;
if (grd(c) == wall || !grid_is_wall(grd(c)))
continue;
// All border grids have neighbours without any access to floor.
if (_has_no_floor_neighbours(c))
grd[x][y] = wall;
}
}