From 1cc856bac7e70027177e66450635e3829be0cb62 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Sat, 14 Nov 2009 17:24:42 +0100 Subject: Add sanctuary option to random_space_weighted. --- crawl-ref/source/teleport.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/teleport.cc') 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_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 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; } -- cgit v1.2.3-54-g00ecf