コード例 #1
0
/*
 * Determine if the given location is "between" two walls,
 * and "next to" two corridor spaces.  XXX XXX XXX
 *
 * Assumes "in_bounds(y, x)"
 */
static bool possible_doorway(int y, int x)
{
	/* Count the adjacent corridors */
	if (next_to_corr(y, x) >= 2)
	{
		/* Check Vertical */
		if ((cave[y-1][x].feat >= FEAT_MAGMA) &&
		    (cave[y+1][x].feat >= FEAT_MAGMA))
		{
			return (TRUE);
		}

		/* Check Horizontal */
		if ((cave[y][x-1].feat >= FEAT_MAGMA) &&
		    (cave[y][x+1].feat >= FEAT_MAGMA))
		{
			return (TRUE);
		}
	}

	/* No doorway */
	return (FALSE);
}
コード例 #2
0
/*
 * Determine if the given location is "between" two walls,
 * and "next to" two corridor spaces. XXX XXX XXX
 *
 * Assumes "in_bounds(y, x)"
 */
static bool possible_doorway(int y, int x)
{
    /* Count the adjacent corridors */
    if (next_to_corr(y, x) >= 2)
    {
        /* Check Vertical */
        if (cave_have_flag_bold(y - 1, x, FF_WALL) &&
            cave_have_flag_bold(y + 1, x, FF_WALL))
        {
            return (TRUE);
        }

        /* Check Horizontal */
        if (cave_have_flag_bold(y, x - 1, FF_WALL) &&
            cave_have_flag_bold(y, x + 1, FF_WALL))
        {
            return (TRUE);
        }
    }

    /* No doorway */
    return (FALSE);
}