diff --git a/lib/IGameCallback.cpp b/lib/IGameCallback.cpp index ae7df063b..4dc1a1c3c 100644 --- a/lib/IGameCallback.cpp +++ b/lib/IGameCallback.cpp @@ -158,17 +158,17 @@ void CPrivilegedInfoCallback::pickAllowedArtsSet(std::vector void CPrivilegedInfoCallback::getAllowedSpells(std::vector & out, std::optional level) { - for (ui32 i = 0; i < gs->map->allowedSpells.size(); i++) //spellh size appears to be greater (?) + for (auto const & spellID : gs->map->allowedSpells) { - const spells::Spell * spell = SpellID(i).toSpell(); + const auto * spell = spellID.toEntity(VLC); - if (!isAllowed(spell->getId())) + if (!isAllowed(spellID)) continue; if (level.has_value() && spell->getLevel() != level) continue; - out.push_back(spell->getId()); + out.push_back(spellID); } } diff --git a/lib/rmg/RmgMap.cpp b/lib/rmg/RmgMap.cpp index 1eaffb1e3..c889e720a 100644 --- a/lib/rmg/RmgMap.cpp +++ b/lib/rmg/RmgMap.cpp @@ -368,12 +368,7 @@ ui32 RmgMap::getTotalZoneCount() const bool RmgMap::isAllowedSpell(const SpellID & sid) const { assert(sid.getNum() >= 0); - if (sid.getNum() < mapInstance->allowedSpells.size()) - { - return mapInstance->allowedSpells.count(sid); - } - else - return false; + return mapInstance->allowedSpells.count(sid); } void RmgMap::dump(bool zoneId) const