summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/view.cc
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-11-12 04:35:34 -0800
committerMatthew Cline <zelgadis@sourceforge.net>2009-11-12 04:36:18 -0800
commite41fc0984375bdab11ad9bcdc14dee2fcb11544d (patch)
treeae6f62207286bea11d2812e1f9db7217aa525dd8 /crawl-ref/source/view.cc
parent56a569bfc142601d6f7e6c05ea749d4d80129c49 (diff)
downloadcrawl-ref-e41fc0984375bdab11ad9bcdc14dee2fcb11544d.tar.gz
crawl-ref-e41fc0984375bdab11ad9bcdc14dee2fcb11544d.zip
view.cc: Auto-exclude harmful clouds
Automatically add exclusions for harmful clouds which are generated by nither monsters nor the player.
Diffstat (limited to 'crawl-ref/source/view.cc')
-rw-r--r--crawl-ref/source/view.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 8bcadd08fe..092ac802d3 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -31,6 +31,7 @@
#include "attitude-change.h"
#include "branch.h"
#include "cio.h"
+#include "cloud.h"
#include "clua.h"
#include "colour.h"
#include "database.h"
@@ -764,8 +765,30 @@ void viewwindow(bool do_updates)
const coord_def ep = view2show(grid2view(gc));
if (in_bounds(gc) && you.see_cell(gc))
+ {
maybe_remove_autoexclusion(gc);
+ // Set excludes in a radius of 1 around harmful clouds genereated
+ // by neither monsters nor the player.
+ const int cloudidx = env.cgrid(gc);
+ if (cloudidx != EMPTY_CLOUD)
+ {
+ cloud_struct &cl = env.cloud[cloudidx];
+ cloud_type ctype = cl.type;
+
+ if (!is_harmless_cloud(ctype)
+ && cl.whose == KC_OTHER
+ && cl.killer == KILL_MISC)
+ {
+ for (adjacent_iterator ai(gc, false); ai; ++ai)
+ {
+ if (!cell_is_solid(*ai) && !is_exclude_root(*ai))
+ set_exclude(*ai, 0);
+ }
+ }
+ }
+ }
+
// Print tutorial messages for features in LOS.
if (Options.tutorial_left
&& in_bounds(gc)