summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/directn.cc15
-rw-r--r--crawl-ref/source/initfile.cc6
-rw-r--r--crawl-ref/source/spl-cast.cc16
3 files changed, 21 insertions, 16 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 68e1509272..29e53c4a53 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -888,13 +888,12 @@ crawl_exit_hook::~crawl_exit_hook()
range_view_annotator::range_view_annotator(int range)
{
- do_anything = (range >= 0);
-
- if (do_anything)
+ if (range >= 0)
{
- Options.target_range = range;
- // Repaint.
-// viewwindow(true, false);
+#ifndef USE_TILE
+ if (Options.target_range != -1)
+#endif
+ Options.target_range = range;
}
}
@@ -906,11 +905,7 @@ range_view_annotator::~range_view_annotator()
void range_view_annotator::restore_state()
{
- if (!do_anything)
- return;
-
Options.target_range = 0;
- do_anything = false;
}
bool _dist_ok(const dist& moves, int range, targ_mode_type mode,
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index d3dda61ca3..d38f411eb0 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -850,6 +850,7 @@ void game_options::reset_options()
target_oos = true;
target_los_first = true;
target_unshifted_dirs = false;
+ target_range = 0; // -1 -> grey out targets out of range
dump_kill_places = KDO_ONE_PLACE;
dump_message_count = 7;
@@ -3016,6 +3017,11 @@ void game_options::read_option_line(const std::string &str, bool runscript)
if (target_unshifted_dirs)
default_target = false;
}
+ else if (key == "darken_beyond_range")
+ {
+ if (!_read_bool(field, target_range != -1))
+ target_range = -1;
+ }
else if (key == "drop_mode")
{
if (field.find("multi") != std::string::npos)
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 61be1b39c5..ff54ef83dd 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -690,7 +690,7 @@ bool cast_a_spell(bool check_range)
const int minRange = _get_dist_to_nearest_monster();
- int keyin = (check_range ? 0 : '?');
+ int keyin = 0;
while (true)
{
@@ -753,13 +753,17 @@ bool cast_a_spell(bool check_range)
{
// Abort if there are no hostiles within range, but flash the range
// markers for about half a second.
- Options.target_range = _calc_spell_range(spell);
- viewwindow(true, false);
mpr("There are no visible monsters within range! (Use <w>Z</w> to "
"cast anyway.)");
- delay(500);
- Options.target_range = 0;
- viewwindow(true, false);
+
+ if (Options.target_range != -1)
+ {
+ Options.target_range = _calc_spell_range(spell);
+ viewwindow(true, false);
+ delay(500);
+ Options.target_range = 0;
+ viewwindow(true, false);
+ }
return (false);
}