mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-26 20:31:41 +00:00
Fix default value for Enums when the key is missing.
This commit is contained in:
parent
aa59eae8c8
commit
8c44d62ed9
1 changed files with 10 additions and 3 deletions
|
|
@ -281,9 +281,16 @@ public:
|
||||||
}
|
}
|
||||||
else if constexpr (std::is_enum_v<T>)
|
else if constexpr (std::is_enum_v<T>)
|
||||||
{
|
{
|
||||||
auto it = EnumTemplate->begin();
|
std::string value = section[Name].value_or(std::string());
|
||||||
|
auto it = EnumTemplate->find(value);
|
||||||
Value = EnumTemplate->at(section[Name].value_or<std::string>(static_cast<std::string>(it->first)));
|
if (it != EnumTemplate->end())
|
||||||
|
{
|
||||||
|
Value = it->second;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Value = DefaultValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue