From 1d3bc0d683b360a293d4c308fcbc3a1176103451 Mon Sep 17 00:00:00 2001 From: Matthew Cline Date: Tue, 17 Nov 2009 17:21:02 -0800 Subject: 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. --- crawl-ref/source/terrain.cc | 25 ++++++++++++++++++------- 1 file 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 doors; + std::set::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); -- cgit v1.2.3-54-g00ecf