diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-06 23:39:51 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-06 23:39:51 +0000 |
commit | dd25b1fc8889a8ecf1970ad4d0accba4850b49fe (patch) | |
tree | 0bea49e0f492a0219b4467a1f62cb6d3b5c00768 /crawl-ref/source/maps.cc | |
parent | 590e197da874d89defd085e799f8171c2880e8e3 (diff) | |
download | crawl-ref-dd25b1fc8889a8ecf1970ad4d0accba4850b49fe.tar.gz crawl-ref-dd25b1fc8889a8ecf1970ad4d0accba4850b49fe.zip |
Allow non-rectangular minivaults and branch entry vaults (use space padding).
They're still rectangular for collision detection with other vaults; that'll
need more effort to fix.
Space padding can also be used for regular vaults, but it'll be ignored at
the moment (but soon...! :-)).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1778 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/maps.cc')
-rw-r--r-- | crawl-ref/source/maps.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc index 95eee85414..be6aa2f249 100644 --- a/crawl-ref/source/maps.cc +++ b/crawl-ref/source/maps.cc @@ -120,6 +120,8 @@ static bool resolve_map(map_def &map, const map_def &original) mprf(MSGCH_WARN, "Lua error: %s", err.c_str()); return (false); } + + map.fixup(); err = map.resolve(); if (!err.empty()) { @@ -145,12 +147,17 @@ static bool resolve_map(map_def &map, const map_def &original) return (true); } -static bool is_grid_clobbered(int sx, int sy, int width, int height) +static bool is_grid_clobbered(const map_def &map, + int sx, int sy, int width, int height) { + const std::vector<std::string> &lines = map.map.get_lines(); for (int y = sy; y < sy + height; ++y) { for (int x = sx; x < sx + width; ++x) { + if (lines[y - sy][x - sx] == ' ') + continue; + const dungeon_feature_type grid = grd[x][y]; if (!grid_is_opaque(grid) @@ -171,8 +178,9 @@ static bool is_grid_clobbered(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(int x, int y, int width, int height, - std::vector<vault_placement> *avoid) +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); @@ -188,7 +196,7 @@ static bool bad_map_place(int x, int y, int width, int height, return (true); } - return (is_grid_clobbered(x, y, width, height)); + return (is_grid_clobbered(map, x, y, width, height)); } static bool apply_vault_grid(map_def &def, map_type map, @@ -232,7 +240,7 @@ static bool apply_vault_grid(map_def &def, map_type map, starty = where.y; } - if (bad_map_place(startx, starty, width, height, avoid)) + if (bad_map_place(def, startx, starty, width, height, avoid)) { #ifdef DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "Bad vault place: (%d,%d) dim (%d,%d)", |