1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-29 13:20:35 +00:00

Address feedback

This commit is contained in:
Evil Eye 2023-06-18 09:37:41 +02:00
parent 967b5d205b
commit f7be94aa21
3 changed files with 9 additions and 7 deletions

View File

@ -14,6 +14,7 @@
#include <components/lua/l10n.hpp>
#include <components/lua/luastate.hpp>
#include <components/lua/utilpackage.hpp>
#include <components/misc/strings/lower.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/statemanager.hpp"
@ -157,15 +158,16 @@ namespace MWLua
};
// TODO: deprecate this and provide access to the store instead
sol::table skill(context.mLua->sol(), sol::create);
api["SKILL"] = LuaUtil::makeStrictReadOnly(skill);
sol::table skills(context.mLua->sol(), sol::create);
api["SKILL"] = LuaUtil::makeStrictReadOnly(skills);
for (int i = 0; i < ESM::Skill::Length; ++i)
{
std::string id = ESM::Skill::indexToRefId(i).serializeText();
std::string key = id;
ESM::RefId skill = ESM::Skill::indexToRefId(i);
std::string id = skill.serializeText();
std::string key = Misc::StringUtils::lowerCase(skill.getRefIdString());
// force first character to uppercase for backwards compatability
key[0] += 'A' - 'a';
skill[key] = id;
skills[key] = id;
}
sol::table attribute(context.mLua->sol(), sol::create);

View File

@ -622,7 +622,7 @@ namespace MWLua
if (rec->mData.mFlags & ESM::MagicEffect::TargetSkill)
{
ESM::RefId skill = ESM::RefId::stringRefId(argStr.value());
ESM::RefId skill = ESM::RefId::deserializeText(argStr.value());
key = MWMechanics::EffectKey(id, ESM::Skill::refIdToIndex(skill));
}
}

View File

@ -41,7 +41,7 @@ namespace
book.mData.mValue = rec["value"];
book.mData.mIsScroll = rec["isScroll"];
ESM::RefId skill = ESM::RefId::stringRefId(rec["skill"].get<std::string_view>());
ESM::RefId skill = ESM::RefId::deserializeText(rec["skill"].get<std::string_view>());
book.mData.mSkillId = -1;
if (!skill.empty())