From ecb40974abb1b8db7db7baf7dba0be77895bb500 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Sun, 8 Jul 2007 10:25:51 +0000 Subject: Vault collision checks were still assuming rectangles, fixed. More minor vault tweaks. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1793 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/maps.cc | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) (limited to 'crawl-ref/source/maps.cc') diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc index 15d6bf5913..1d609e3929 100644 --- a/crawl-ref/source/maps.cc +++ b/crawl-ref/source/maps.cc @@ -147,9 +147,15 @@ static bool resolve_map(map_def &map, const map_def &original) return (true); } -static bool is_grid_clobbered(const map_def &map, - int sx, int sy, int width, int height) +// Determines if the region specified by (x, y, x + width - 1, y + height - 1) +// is a bad place to build a vault. +static bool bad_map_place(const map_def &map, + int sx, int sy, int width, int height, + std::vector *avoid) { + if (!avoid) + return (false); + const std::vector &lines = map.map.get_lines(); for (int y = sy; y < sy + height; ++y) { @@ -157,6 +163,9 @@ static bool is_grid_clobbered(const map_def &map, { if (lines[y - sy][x - sx] == ' ') continue; + + if (dgn_map_mask[x][y]) + return (true); const dungeon_feature_type grid = grd[x][y]; @@ -176,29 +185,6 @@ static bool is_grid_clobbered(const map_def &map, return (false); } -// Determines if the region specified by (x, y, x + width - 1, y + height - 1) -// is a bad place to build a vault. -static bool bad_map_place(const map_def &map, - int x, int y, int width, int height, - std::vector *avoid) -{ - if (!avoid) - return (false); - - const dgn_region thisvault(x, y, width, height); - - for (int i = 0, size = avoid->size(); i < size; ++i) - { - const vault_placement &vp = (*avoid)[i]; - const dgn_region vault(vp.x, vp.y, vp.width, vp.height); - - if (thisvault.overlaps(vault) && thisvault.overlaps(dgn_map_mask)) - return (true); - } - - return (is_grid_clobbered(map, x, y, width, height)); -} - static bool apply_vault_grid(map_def &def, map_type map, vault_placement &place, std::vector *avoid) -- cgit v1.2.3-54-g00ecf