MCPcopy Create free account
hub / github.com/crawl/crawl / add_auto_excludes

Function add_auto_excludes

crawl-ref/source/exclude.cc:90–125  ·  view source on GitHub ↗

* Adds auto-exclusions for any monsters in LOS that need them. */

Source from the content-addressed store, hash-verified

88 * Adds auto-exclusions for any monsters in LOS that need them.
89 */
90void add_auto_excludes()
91{
92 if (!is_map_persistent() || !map_bounds(you.pos()))
93 return;
94
95 vector<monster*> mons;
96 for (radius_iterator ri(you.pos(), LOS_DEFAULT); ri; ++ri)
97 {
98 monster *mon = monster_at(*ri);
99 if (!mon || mon->is_summoned())
100 continue;
101
102 // Something of a speed hack, but some vaults have a TON of plants.
103 if (mon->is_firewood())
104 continue;
105 if (_need_auto_exclude(mon) && !is_exclude_root(*ri))
106 {
107 int radius = _get_full_exclusion_radius();
108 // Sting and Harpoon Shot's minimum ranges, respectively.
109 if (mon->type == MONS_SCRUB_NETTLE)
110 radius = min(radius, 4);
111 else if (mon->type == MONS_STARFLOWER)
112 radius = min(radius, 6);
113
114 set_exclude(*ri, radius, true);
115 mons.emplace_back(mon);
116 }
117 }
118
119 if (mons.empty())
120 return;
121
122 mprf(MSGCH_WARN, "Marking area around %s as unsafe for travelling.",
123 describe_monsters_condensed(mons).c_str());
124 learned_something_new(HINT_AUTO_EXCLUSION);
125}
126
127travel_exclude::travel_exclude(const coord_def &p, int r,
128 bool autoexcl, string dsc, bool vaultexcl)

Callers 1

world_reactsFunction · 0.85

Calls 14

is_map_persistentFunction · 0.85
map_boundsFunction · 0.85
monster_atFunction · 0.85
_need_auto_excludeFunction · 0.85
is_exclude_rootFunction · 0.85
set_excludeFunction · 0.85
mprfFunction · 0.85
learned_something_newFunction · 0.85
posMethod · 0.45
is_summonedMethod · 0.45

Tested by

no test coverage detected