| 143 | static mon_name_map Mon_Name_Cache; |
| 144 | |
| 145 | void 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 | |
| 175 | static const char *_mon_entry_name(size_t idx) |
| 176 | { |
no test coverage detected