From d87a308f449bb959db24495e2a1dc307924bc8ae Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Thu, 8 Oct 2009 22:40:29 +0200 Subject: Split and correct grid_see_grid. There's now cell_see_cell which tests for visibility correctly, albeit slowly. That's only used for placing features in the abyss currently, but needs to be improved if it gets used more. The second function used in monster movement was left as is, but renamed to can_go_straight. This remains unreliable but probably serves its purpose. The grid_see_grid test is adapted to cell_see_cell; the grid_see_grid lua binding is now actually useful. Also reduce the number of tests in los_csc and los_symm. --- crawl-ref/source/losparam.cc | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source/losparam.cc') diff --git a/crawl-ref/source/losparam.cc b/crawl-ref/source/losparam.cc index 85e0954499..cd746d0b58 100644 --- a/crawl-ref/source/losparam.cc +++ b/crawl-ref/source/losparam.cc @@ -50,23 +50,40 @@ opacity_type los_param_permissive::opacity(const coord_def& p) const } -/* los_param_base */ +/* los_param_nocloud */ -los_param_base::los_param_base(const coord_def& c) +los_param_nocloud::los_param_nocloud(const coord_def& c) : los_param_trans(c) { } -dungeon_feature_type los_param_base::feature(const coord_def& p) const +dungeon_feature_type los_param_nocloud::feature(const coord_def& p) const { return env.grid(trans(p)); } -unsigned los_param_base::appearance(const coord_def& p) const +unsigned los_param_nocloud::appearance(const coord_def& p) const { return grid_appearance(trans(p)); } +opacity_type los_param_nocloud::opacity(const coord_def& p) const +{ + dungeon_feature_type f = feature(p); + if (grid_is_opaque(f)) + return OPC_OPAQUE; + else + return OPC_CLEAR; +} + + +/* los_param_base */ + +los_param_base::los_param_base(const coord_def& c) + : los_param_nocloud(c) +{ +} + unsigned short los_param_base::cloud_idx(const coord_def& p) const { return env.cgrid(trans(p)); -- cgit v1.2.3-54-g00ecf