diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-11-14 17:24:42 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-14 17:26:42 +0100 |
commit | 1cc856bac7e70027177e66450635e3829be0cb62 (patch) | |
tree | cb27dfdfa2810c227f8d4da9efda6824831bf6cf | |
parent | 39c107535e8796b517e78f68a18d29ee265866f1 (diff) | |
download | crawl-ref-1cc856bac7e70027177e66450635e3829be0cb62.tar.gz crawl-ref-1cc856bac7e70027177e66450635e3829be0cb62.zip |
Add sanctuary option to random_space_weighted.
-rw-r--r-- | crawl-ref/source/teleport.cc | 6 |
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; } |