without prompting the user. If there aren't any doors which can be opened/closed, note that without prompting the user.
Also, closing doors is now subject to confusion effects like opening doors is.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5288 c06c8d41-db1a-0410-9941-cceddc491573
QLMCSREGK2UUAPXZSZQKLZOLM4BCB7PAVCSR3DLFQS3EW3IMWQSQC
* Check squares adjacent to player for given feature and return how
* many there are. If there's only one, return the dx and dy.
*/
static int _check_adjacent(dungeon_feature_type feat, int &dx, int &dy)
{
int num = 0;
int _dx, _dy;
for (int x = -1; x <= 1; x++)
for (int y = -1; y <= 1; y++)
if (grd[you.x_pos + x][you.y_pos + y] == feat)
{
num++;
_dx = x;
_dy = y;
}
if (num == 1)
{
dx = _dx;
dy = _dy;
}
return num;
}
/*
// If there's only one door to close, don't ask.
if (!you.duration[DUR_CONF] && !(door_x || door_y))
{
int num = _check_adjacent(DNGN_OPEN_DOOR, door_x, door_y);
if (num == 0)
{
mpr("There's nothing to close.");
return;
}
else if (num == 1 && !(door_x || door_y))
{
mpr("You can't close doors on yourself!");
return;
}
}