mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-06-06 01:13:45 -04:00
fix for gamelist view enums
This commit is contained in:
parent
62f6bb9d1c
commit
e04cfc6f81
1 changed files with 9 additions and 1 deletions
|
|
@ -102,7 +102,15 @@ public:
|
|||
* @param val The desired value
|
||||
*/
|
||||
virtual void SetValue(const Type& val) {
|
||||
Type temp{ranged ? std::clamp(val, minimum, maximum) : val};
|
||||
// Enums have a maximal range which they're allowed
|
||||
Type temp{};
|
||||
if constexpr (std::is_enum_v<Type>) {
|
||||
auto const r_min = std::underlying_type_t<Type>(0);
|
||||
auto const r_max = std::underlying_type_t<Type>(EnumMetadata<Type>::GetLast());
|
||||
temp = Type(std::clamp(std::underlying_type_t<Type>(val), r_min, r_max));
|
||||
} else {
|
||||
temp = ranged ? std::clamp(val, this->minimum, this->maximum) : val;
|
||||
}
|
||||
std::swap(value, temp);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue