1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-31 14:36:39 +00:00

clang warnings/errors

This commit is contained in:
Mads Buvik Sandvei 2023-05-20 18:44:39 +02:00
parent 7ba43c9426
commit 87250bfabf

View file

@ -37,11 +37,11 @@ namespace MWLua
template <typename Store> template <typename Store>
struct ActorStore struct ActorStore
{ {
using Collection = Store::Collection; using Collection = typename Store::Collection;
using Iterator = Collection::const_iterator; using Iterator = typename Collection::const_iterator;
const ObjectVariant mActor; const ObjectVariant mActor;
Store* store = nullptr; Store* store = nullptr;
Iterator it; Iterator it = Iterator();
int index = 0; int index = 0;
void reset() void reset()
@ -106,7 +106,8 @@ namespace MWLua
return spellOrId.as<const ESM::Spell*>()->mId; return spellOrId.as<const ESM::Spell*>()->mId;
else else
return ESM::RefId::deserializeText(LuaUtil::cast<std::string_view>(spellOrId)); return ESM::RefId::deserializeText(LuaUtil::cast<std::string_view>(spellOrId));
}; }
static const ESM::Spell* toSpell(const sol::object& spellOrId) static const ESM::Spell* toSpell(const sol::object& spellOrId)
{ {
if (spellOrId.is<ESM::Spell>()) if (spellOrId.is<ESM::Spell>())
@ -117,7 +118,7 @@ namespace MWLua
auto refId = ESM::RefId::deserializeText(LuaUtil::cast<std::string_view>(spellOrId)); auto refId = ESM::RefId::deserializeText(LuaUtil::cast<std::string_view>(spellOrId));
return store.get<ESM::Spell>().find(refId); return store.get<ESM::Spell>().find(refId);
} }
}; }
sol::table initCoreMagicBindings(const Context& context) sol::table initCoreMagicBindings(const Context& context)
{ {
@ -260,7 +261,7 @@ namespace MWLua
magicEffectT[sol::meta_function::to_string] = [](const ESM::MagicEffect& rec) { magicEffectT[sol::meta_function::to_string] = [](const ESM::MagicEffect& rec) {
return "ESM3_MagicEffect[" + ESM::MagicEffect::effectIdToString(rec.mIndex) + "]"; return "ESM3_MagicEffect[" + ESM::MagicEffect::effectIdToString(rec.mIndex) + "]";
}; };
magicEffectT["id"] = sol::readonly_property([](const ESM::MagicEffect& rec) -> std::string_view { magicEffectT["id"] = sol::readonly_property([](const ESM::MagicEffect& rec) -> std::string {
auto gmstName = ESM::MagicEffect::effectIdToString(rec.mIndex); auto gmstName = ESM::MagicEffect::effectIdToString(rec.mIndex);
auto name = gmstName.substr(7); // Remove the 'sEffect' prefix auto name = gmstName.substr(7); // Remove the 'sEffect' prefix
return Misc::StringUtils::lowerCase(name); return Misc::StringUtils::lowerCase(name);
@ -292,7 +293,7 @@ namespace MWLua
activeEffectT[sol::meta_function::to_string] = [](const ActiveEffect& effect) { activeEffectT[sol::meta_function::to_string] = [](const ActiveEffect& effect) {
return "ActiveEffect[" + ESM::MagicEffect::effectIdToString(effect.key.mId) + "]"; return "ActiveEffect[" + ESM::MagicEffect::effectIdToString(effect.key.mId) + "]";
}; };
activeEffectT["id"] = sol::readonly_property([](const ActiveEffect& effect) -> std::string_view { activeEffectT["id"] = sol::readonly_property([](const ActiveEffect& effect) -> std::string {
auto gmstName = ESM::MagicEffect::effectIdToString(effect.key.mId); auto gmstName = ESM::MagicEffect::effectIdToString(effect.key.mId);
auto name = gmstName.substr(7); // Remove the 'sEffect' prefix auto name = gmstName.substr(7); // Remove the 'sEffect' prefix
return Misc::StringUtils::lowerCase(name); return Misc::StringUtils::lowerCase(name);