diff options
author | Raphael Langella <raphael.langella@gmail.com> | 2011-02-24 14:52:37 +0100 |
---|---|---|
committer | Raphael Langella <raphael.langella@gmail.com> | 2011-02-24 19:21:03 +0100 |
commit | 61fa7851b5e5106d8b7b42e215bd5916993eef9a (patch) | |
tree | d25f144959e8a26e8169c84da7f2791429ec4f0e /crawl-ref/source/mon-pathfind.cc | |
parent | b67fc5b31cdc807399a27c62a223da5b58f1e4f1 (diff) | |
download | crawl-ref-61fa7851b5e5106d8b7b42e215bd5916993eef9a.tar.gz crawl-ref-61fa7851b5e5106d8b7b42e215bd5916993eef9a.zip |
Allow wall clinging when on liquefied ground.
Preventing it isn't very interseting, and allowing it makes the code much simpler.
Diffstat (limited to 'crawl-ref/source/mon-pathfind.cc')
-rw-r--r-- | crawl-ref/source/mon-pathfind.cc | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/crawl-ref/source/mon-pathfind.cc b/crawl-ref/source/mon-pathfind.cc index a2293d3e33..0622e62f98 100644 --- a/crawl-ref/source/mon-pathfind.cc +++ b/crawl-ref/source/mon-pathfind.cc @@ -101,7 +101,6 @@ bool monster_pathfind::init_pathfind(const monster* mon, coord_def dest, start = mon->pos(); target = dest; pos = start; - clinging = mon->is_wall_clinging(); allow_diagonals = diag; traverse_unmapped = pass_unmapped; @@ -178,12 +177,6 @@ bool monster_pathfind::calc_path_to_neighbours() { coord_def npos; int distance, old_dist, total; - if (mons) - { - // Is this supposed to override the initial setting? - clinging = mons->can_cling_to_walls() - && cell_is_clingable(pos, clinging); - } // For each point, we look at all neighbour points. Check the orthogonals // last, so that, should an orthogonal and a diagonal direction have the @@ -407,7 +400,7 @@ bool monster_pathfind::traversable(const coord_def& p) return (false); if (mons) - return mons_traversable(p) || clinging && cell_can_cling_to(pos, p); + return mons_traversable(p); return feat_has_solid_floor(grd(p)); } @@ -416,8 +409,9 @@ bool monster_pathfind::traversable(const coord_def& p) // its preferred habit and capability of flight or opening doors. bool monster_pathfind::mons_traversable(const coord_def& p) { - return (mons_can_traverse(mons, p) - || mons->can_cling_to_walls() && cell_can_cling_to(pos, p)); + return mons_can_traverse(mons, p) || mons->can_cling_to_walls() + && cell_is_clingable(pos) + && cell_can_cling_to(pos, p); } int monster_pathfind::travel_cost(coord_def npos) @@ -444,6 +438,7 @@ int monster_pathfind::mons_travel_cost(coord_def npos) const monster_type mt = mons_base_type(mons); const bool ground_level = !mons_airborne(mt, -1, false) && !(mons->can_cling_to_walls() + && cell_is_clingable(pos) && cell_can_cling_to(pos, npos)); // Travelling through water, entering or leaving water is more expensive |