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

View File

@ -622,7 +622,7 @@ namespace MWLua
if (rec->mData.mFlags & ESM::MagicEffect::TargetSkill) 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)); key = MWMechanics::EffectKey(id, ESM::Skill::refIdToIndex(skill));
} }
} }

View File

@ -41,7 +41,7 @@ namespace
book.mData.mValue = rec["value"]; book.mData.mValue = rec["value"];
book.mData.mIsScroll = rec["isScroll"]; 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; book.mData.mSkillId = -1;
if (!skill.empty()) if (!skill.empty())