1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-27 05:37:25 +00:00

Make input.triggers[] consistent with input.actions[]

This commit is contained in:
uramer 2024-01-02 13:45:45 +01:00
parent 5f2cbf810d
commit 1d8ee7984f
2 changed files with 9 additions and 5 deletions

View File

@ -265,6 +265,14 @@ namespace LuaUtil
mHandlers.push_back({});
}
std::optional<Info> Registry::operator[](std::string_view key)
{
auto iter = mIds.find(key);
if (iter == mIds.end())
return std::nullopt;
return mInfo[iter->second];
}
void Registry::registerHandler(std::string_view key, const LuaUtil::Callback& callback)
{
Id id = safeIdByKey(key);

View File

@ -126,11 +126,7 @@ namespace LuaUtil::InputTrigger
return std::nullopt;
return it->first;
}
std::optional<Info> operator[](std::string_view key)
{
Id id = safeIdByKey(key);
return mInfo[id];
}
std::optional<Info> operator[](std::string_view key);
void insert(Info info);
void registerHandler(std::string_view key, const LuaUtil::Callback& callback);
void activate(std::string_view key);