From baac5dcb6b5ae6f006cedcd3ff708b03df84bd69 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Mon, 19 Oct 2009 12:16:45 +0200 Subject: Wrap losight() in class los_def together with env_show_grid. --- crawl-ref/source/los.cc | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'crawl-ref/source/los.cc') diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc index 8213e825a4..f42f55afbf 100644 --- a/crawl-ref/source/los.cc +++ b/crawl-ref/source/los.cc @@ -920,6 +920,44 @@ void losight(env_show_grid& sh, const coord_def& center, losight(sh, los_param_funcs(center, opc, bounds)); } + +// class los +// TODO: lazy update? + +los_def::los_def() {} + +los_def::los_def(const coord_def& c, const opacity_func &o, + const bounds_func &b) +{ + init(c, o, b); +} + +void los_def::init(const coord_def& c, const opacity_func &o, + const bounds_func &b) +{ + center = &c; + opc = &o; + bds = &b; + update(); +} + +void los_def::update() +{ + losight(show, *center, *opc, *bds); +} + +void los_def::set_center(const coord_def& c) +{ + center = &c; + update(); +} + +bool los_def::see_cell(const coord_def& p) const +{ + return (::see_cell(show, *center, p)); +} + + void losight_permissive(env_show_grid &sh, const coord_def& center) { for (int x = -ENV_SHOW_OFFSET; x <= ENV_SHOW_OFFSET; ++x) @@ -931,6 +969,7 @@ void losight_permissive(env_show_grid &sh, const coord_def& center) } } + void calc_show_los() { if (!crawl_state.arena && !crawl_state.arena_suspended) -- cgit v1.2.3-54-g00ecf