diff options
author | Ed Gonzalez <ed.gonzalez3@gmail.com> | 2013-06-02 04:01:33 -0700 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2013-06-02 13:52:18 +0200 |
commit | 0d6c8afeece7e6e87120bf39c7b0831a9d132f88 (patch) | |
tree | 9f90cb1ca9cde92da1240947219b2045a494bc9b /crawl-ref/source/teleport.cc | |
parent | 5a848df107bd9b7633e193c552bbed01a5b065b1 (diff) | |
download | crawl-ref-0d6c8afeece7e6e87120bf39c7b0831a9d132f88.tar.gz crawl-ref-0d6c8afeece7e6e87120bf39c7b0831a9d132f88.zip |
Fixed lava orcs blinking into deep water
Previously, random_near_space assumed that if lava was safe, then so was
deep water. Now that we've broken that assumption, this introduces a
check for each feature in (DNGN_MINMOVE <= feat < DNGN_MINWALK). At the
moment, this is just deep water and lava.
Each such feature is first checked if the player can permanently enter
it safely (as before), and then attempted targets are checked against
a flag for the appropriate feature, rather than the one assumed to be
more dangerous.
Diffstat (limited to 'crawl-ref/source/teleport.cc')
-rw-r--r-- | crawl-ref/source/teleport.cc | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crawl-ref/source/teleport.cc b/crawl-ref/source/teleport.cc index 89dac884fc..767803d2dd 100644 --- a/crawl-ref/source/teleport.cc +++ b/crawl-ref/source/teleport.cc @@ -245,13 +245,8 @@ bool random_near_space(const coord_def& origin, coord_def& target, DNGN_MAX_NONREACH); } - dungeon_feature_type limit; - if (!is_feat_dangerous(DNGN_LAVA, true)) - limit = DNGN_LAVA; - else if (!is_feat_dangerous(DNGN_DEEP_WATER, true)) - limit = DNGN_DEEP_WATER; - else - limit = DNGN_SHALLOW_WATER; + const bool lava_dangerous = is_feat_dangerous(DNGN_LAVA, true); + const bool water_dangerous = is_feat_dangerous(DNGN_DEEP_WATER, true); for (int tries = 0; tries < 150; tries++) { @@ -269,7 +264,10 @@ bool random_near_space(const coord_def& origin, coord_def& target, if (!in_bounds(target) || restrict_los && !you.see_cell(target) - || grd(target) < limit + || grd(target) < DNGN_MINMOVE // Target always invalid + || (grd(target) < DNGN_MINWALK // Target maybe invalid + && (grd(target) == DNGN_LAVA && lava_dangerous + || grd(target) == DNGN_DEEP_WATER && water_dangerous)) || actor_at(target) || !allow_adjacent && distance2(origin, target) <= 2 || forbid_sanctuary && is_sanctuary(target)) |