summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/maps.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-08 10:25:51 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-08 10:25:51 +0000
commitecb40974abb1b8db7db7baf7dba0be77895bb500 (patch)
treeb5b5169ec1a8feee9a217ca6492f2fbb09af6b6e /crawl-ref/source/maps.cc
parentb0e3bb6ae065f4c5c8684dc006d8f974287658fe (diff)
downloadcrawl-ref-ecb40974abb1b8db7db7baf7dba0be77895bb500.tar.gz
crawl-ref-ecb40974abb1b8db7db7baf7dba0be77895bb500.zip
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
Diffstat (limited to 'crawl-ref/source/maps.cc')
-rw-r--r--crawl-ref/source/maps.cc36
1 files changed, 11 insertions, 25 deletions
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<vault_placement> *avoid)
{
+ if (!avoid)
+ return (false);
+
const std::vector<std::string> &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<vault_placement> *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<vault_placement> *avoid)