From e41fc0984375bdab11ad9bcdc14dee2fcb11544d Mon Sep 17 00:00:00 2001 From: Matthew Cline Date: Thu, 12 Nov 2009 04:35:34 -0800 Subject: view.cc: Auto-exclude harmful clouds Automatically add exclusions for harmful clouds which are generated by nither monsters nor the player. --- crawl-ref/source/view.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'crawl-ref/source/view.cc') 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) -- cgit v1.2.3-54-g00ecf