From 2c9b3ce286f5c274cb0348253259bcca24d967a3 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Mon, 16 Nov 2009 17:48:53 +0100 Subject: Simplify out-of-range darkening. Also fixes the range_view_annotator destructor clobbering option "darken_beyond_range". Options.target_range is now really an option, and called Options.darken_beyond_range. Current darkening range is now stored in crawl_state.darken_range. I can't reproduce SIGHUP retaining darkened range (BR 2151183) (why would it be saved?), so range_view_annotator is not a crawl_exit_hook anymore. crawl_exit_hook is not used anymore, but still present. --- crawl-ref/source/directn.cc | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'crawl-ref/source/directn.cc') diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index ba02499131..8230db5e3e 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -875,24 +875,20 @@ crawl_exit_hook::~crawl_exit_hook() range_view_annotator::range_view_annotator(int range) { - if (range >= 0) + if (Options.darken_beyond_range && range >= 0) { -#ifndef USE_TILE - if (Options.target_range != -1) -#endif - Options.target_range = range; + crawl_state.darken_range = range; + viewwindow(false, false); } } range_view_annotator::~range_view_annotator() { - restore_state(); - viewwindow(false); -} - -void range_view_annotator::restore_state() -{ - Options.target_range = 0; + if (Options.darken_beyond_range && crawl_state.darken_range >= 0) + { + crawl_state.darken_range = -1; + viewwindow(false, false); + } } bool _dist_ok(const dist& moves, int range, targ_mode_type mode, @@ -1668,6 +1664,7 @@ void direction(dist& moves, targetting_type restricts, if (need_beam_redraw) { #ifndef USE_TILE + // Clear the old ray. viewwindow(false, false); #endif if (show_beam && have_beam) -- cgit v1.2.3-54-g00ecf