summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/terrain.cc
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-11-17 17:21:02 -0800
committerMatthew Cline <zelgadis@sourceforge.net>2009-11-17 20:28:01 -0800
commit1d3bc0d683b360a293d4c308fcbc3a1176103451 (patch)
tree08ac625c09b9d6a8fba1b34bed9d3273297086ed /crawl-ref/source/terrain.cc
parentca49d65dbd3a24ba1e4a3fb2ba0ca7ebcc685f5d (diff)
downloadcrawl-ref-1d3bc0d683b360a293d4c308fcbc3a1176103451.tar.gz
crawl-ref-1d3bc0d683b360a293d4c308fcbc3a1176103451.zip
Bug 2886291: middle of secret gates looked wrong
If you had a bunch of secret doors in a row, forming a gate, then only the ones at the end one pick up the right feature to immitate, with the ones in the middle always being rock wall.
Diffstat (limited to 'crawl-ref/source/terrain.cc')
-rw-r--r--crawl-ref/source/terrain.cc25
1 files changed, 18 insertions, 7 deletions
diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc
index a85f8276e1..c583815690 100644
--- a/crawl-ref/source/terrain.cc
+++ b/crawl-ref/source/terrain.cc
@@ -494,18 +494,28 @@ dungeon_feature_type grid_appearance(const coord_def &gc)
dungeon_feature_type grid_secret_door_appearance(const coord_def &where)
{
+ std::set<coord_def> doors;
+ std::set<coord_def>::iterator it;
+
+ find_connected_range(where, DNGN_CLOSED_DOOR, DNGN_SECRET_DOOR,
+ doors);
+
dungeon_feature_type ret = DNGN_FLOOR;
- for (int dx = -1; dx <= 1; dx++)
- for (int dy = -1; dy <= 1; dy++)
+ int orth[][2] = { {0, 1}, {1, 0,}, {-1, 0}, {0, -1} };
+
+ for (it = doors.begin(); it != doors.end(); ++it)
+ {
+ for (int i = 0; i < 4; i++)
{
- // only considering orthogonal cells
- if ((abs(dx) + abs(dy)) % 2 == 0)
- continue;
+ const int x = it->x + orth[i][0];
+ const int y = it->y + orth[i][1];
- const dungeon_feature_type targ = grd[where.x + dx][where.y + dy];
+ if (!in_bounds(x, y))
+ continue;
- if (!feat_is_wall(targ))
+ const dungeon_feature_type targ = grd[x][y];
+ if (!feat_is_wall(targ) || feat_is_closed_door(targ))
continue;
if (ret == DNGN_FLOOR)
@@ -513,6 +523,7 @@ dungeon_feature_type grid_secret_door_appearance(const coord_def &where)
else if (ret != targ)
ret = ((ret < targ) ? ret : targ);
}
+ }
return ((ret == DNGN_FLOOR) ? DNGN_ROCK_WALL
: ret);