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

Function init_mon_name_cache

crawl-ref/source/mon-util.cc:145–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143static mon_name_map Mon_Name_Cache;
144
145void init_mon_name_cache()
146{
147 if (!Mon_Name_Cache.empty())
148 return;
149
150 for (const monsterentry &me : mondata)
151 {
152 const int mtype = me.mc;
153 const monster_type mon = monster_type(mtype);
154
155 // Deal sensibly with duplicate entries; refuse or allow the
156 // insert, depending on which should take precedence. Some
157 // uniques of multiple forms can get away with this, though.
158 if (mon == MONS_BAI_SUZHEN_DRAGON
159 || mon != MONS_SERPENT_OF_HELL
160 && mons_species(mon) == MONS_SERPENT_OF_HELL)
161 {
162 continue;
163 }
164
165 string name = me.name;
166 lowercase(name);
167
168 if (Mon_Name_Cache.count(name))
169 die("Un-handled duplicate monster name: %s", name.c_str());
170
171 Mon_Name_Cache[name] = mon;
172 }
173}
174
175static const char *_mon_entry_name(size_t idx)
176{

Callers 2

_initializeFunction · 0.85
initialize_crawlFunction · 0.85

Calls 5

monster_typeEnum · 0.85
mons_speciesFunction · 0.85
dieFunction · 0.70
emptyMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected