| 187 | } |
| 188 | |
| 189 | void 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 |
nothing calls this directly
no test coverage detected