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

Method update

crawl-ref/source/tilereg-spl.cc:189–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187}
188
189void SpellRegion::update()
190{
191 m_items.clear();
192 m_dirty = true;
193
194 if (mx * my == 0)
195 return;
196
197 const unsigned int max_spells = min(22, mx*my);
198
199 for (int i = 0; i < 52; ++i)
200 {
201 const char letter = index_to_letter(i);
202 const spell_type spell = get_spell_by_letter(letter);
203 if (spell == SPELL_NO_SPELL)
204 continue;
205
206 InventoryTile desc;
207 desc.tile = tileidx_spell(spell);
208 desc.idx = (int) spell;
209 desc.quantity = spell_mana(spell);
210
211 if (tile_command_not_applicable(CMD_CAST_SPELL, true)
212 || spell_is_useless(spell, true, true))
213 {
214 desc.flag |= TILEI_FLAG_INVALID;
215 }
216
217 m_items.push_back(desc);
218
219 if (m_items.size() >= max_spells)
220 break;
221 }
222}
223
224#endif

Callers

nothing calls this directly

Calls 9

get_spell_by_letterFunction · 0.85
tileidx_spellFunction · 0.85
spell_manaFunction · 0.85
spell_is_uselessFunction · 0.85
index_to_letterFunction · 0.70
clearMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected