summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/teleport.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-14 17:24:42 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-14 17:26:42 +0100
commit1cc856bac7e70027177e66450635e3829be0cb62 (patch)
treecb27dfdfa2810c227f8d4da9efda6824831bf6cf /crawl-ref/source/teleport.cc
parent39c107535e8796b517e78f68a18d29ee265866f1 (diff)
downloadcrawl-ref-1cc856bac7e70027177e66450635e3829be0cb62.tar.gz
crawl-ref-1cc856bac7e70027177e66450635e3829be0cb62.zip
Add sanctuary option to random_space_weighted.
Diffstat (limited to 'crawl-ref/source/teleport.cc')
-rw-r--r--crawl-ref/source/teleport.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/crawl-ref/source/teleport.cc b/crawl-ref/source/teleport.cc
index 3a10012c30..ef9cf3a025 100644
--- a/crawl-ref/source/teleport.cc
+++ b/crawl-ref/source/teleport.cc
@@ -69,7 +69,8 @@ typedef std::pair<coord_def, int> coord_weight;
// Try to find a "safe" place for moved close or far from the target.
// keep_los indicates that the destination should be in view of the target.
static coord_def random_space_weighted(actor* moved, actor* target,
- bool close, bool keep_los = true)
+ bool close, bool keep_los = true,
+ bool allow_sanct = true)
{
std::vector<coord_weight> dests;
const coord_def tpos = target->pos();
@@ -79,7 +80,8 @@ static coord_def random_space_weighted(actor* moved, actor* target,
for (radius_iterator ri(mlos); ri; ++ri)
{
if (!moved->is_habitable(*ri) || actor_at(*ri)
- || keep_los && !tlos->see_cell(*ri))
+ || keep_los && !tlos->see_cell(*ri)
+ || !allow_sanct && is_sanctuary(*ri))
{
continue;
}