diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-12 03:03:37 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-12 03:03:37 +0000 |
commit | 6d752d6fba7259fcb9dcca0566cbc1826d14d218 (patch) | |
tree | c1533a338bf31c2fecef2ad42f5ca1d6e78721f1 /crawl-ref/source/terrain.cc | |
parent | fe72c7328fd2e8419debec5a3b82758af469fdc3 (diff) | |
download | crawl-ref-6d752d6fba7259fcb9dcca0566cbc1826d14d218.tar.gz crawl-ref-6d752d6fba7259fcb9dcca0566cbc1826d14d218.zip |
Include secret doors in door-clustering (gates) when opening doors.
In otherwords, if there's a line of secret doors with just one non-secret
closed door among them and the non-secret door is opened, open up all
the secret doors.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5744 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/terrain.cc')
-rw-r--r-- | crawl-ref/source/terrain.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index 2ae8d1c2d6..fd4a204617 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -244,6 +244,21 @@ void find_connected_identical(coord_def d, dungeon_feature_type ft, } } +// Find all connected cells containing ft_min to ft_max, starting at d. +void find_connected_range(coord_def d, dungeon_feature_type ft_min, + dungeon_feature_type ft_max, + std::set<coord_def>& out) +{ + if (grd[d.x][d.y] < ft_min || grd[d.x][d.y] > ft_max) return; + if (out.insert(d).second) + { + find_connected_range(coord_def(d.x+1, d.y), ft_min, ft_max, out); + find_connected_range(coord_def(d.x-1, d.y), ft_min, ft_max, out); + find_connected_range(coord_def(d.x, d.y+1), ft_min, ft_max, out); + find_connected_range(coord_def(d.x, d.y-1), ft_min, ft_max, out); + } +} + void get_door_description(int door_size, const char** adjective, const char** noun) { const char* descriptions[] = { |