summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/exclude.cc
diff options
context:
space:
mode:
authorJohanna Ploog <j-p-e-g@users.sourceforge.net>2011-04-05 17:44:44 +0200
committerJohanna Ploog <j-p-e-g@users.sourceforge.net>2011-04-05 17:49:15 +0200
commitbf2ef4326c7936700f3ead7fdf2e222e857193e1 (patch)
tree02eee014d4836def5946faeac8ef9c617bc7dcbc /crawl-ref/source/exclude.cc
parent14d3a05d939f57fd67150af872d452610d29f0fa (diff)
downloadcrawl-ref-bf2ef4326c7936700f3ead7fdf2e222e857193e1.tar.gz
crawl-ref-bf2ef4326c7936700f3ead7fdf2e222e857193e1.zip
Mantis #3727: When excluding part of a gate, exclude all of it.
To prevent autotravelling through a gate, you need to exclude all doors belonging to it. Single-excluding a single door tile now sets exclusions for all doors belonging to the same gate. Similarly, removing such an exclusion also affects the gate as a whole.
Diffstat (limited to 'crawl-ref/source/exclude.cc')
-rw-r--r--crawl-ref/source/exclude.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/crawl-ref/source/exclude.cc b/crawl-ref/source/exclude.cc
index 5c6fd6d790..123f107ec7 100644
--- a/crawl-ref/source/exclude.cc
+++ b/crawl-ref/source/exclude.cc
@@ -455,12 +455,31 @@ void clear_excludes()
_exclude_update();
}
+static void _exclude_gate(const coord_def &p, bool del = false)
+{
+ std::set<coord_def> all_doors;
+ find_connected_identical(p, grd(p), all_doors);
+ for (std::set<coord_def>::const_iterator dc = all_doors.begin();
+ dc != all_doors.end(); ++dc)
+ {
+ if (del)
+ del_exclude(*dc);
+ else
+ set_exclude(*dc, 0);
+ }
+}
+
// Cycles the radius of an exclusion, including "off" state;
// may start at 0 < radius < LOS_RADIUS, but won't cycle there.
void cycle_exclude_radius(const coord_def &p)
{
if (travel_exclude *exc = curr_excludes.get_exclude_root(p))
{
+ if (feat_is_door(grd(p)))
+ {
+ _exclude_gate(p, exc->radius == 0);
+ return;
+ }
if (exc->radius > 0)
set_exclude(p, 0);
else