mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-10-20 23:20:36 +02:00
bring back evil strings
This commit is contained in:
parent
4db1ce2cf2
commit
dd66bdb22c
1 changed files with 16 additions and 10 deletions
|
|
@ -195,16 +195,22 @@ public:
|
|||
this->SetValue(this->GetDefault());
|
||||
return;
|
||||
}
|
||||
if constexpr (std::is_same_v<Type, std::string>) {
|
||||
this->SetValue(input);
|
||||
} else if constexpr (std::is_same_v<Type, std::optional<u32>>) {
|
||||
this->SetValue(u32(std::strtoul(input.c_str(), nullptr, 10)));
|
||||
} else if constexpr (std::is_same_v<Type, bool>) {
|
||||
this->SetValue(input == "true");
|
||||
} else if constexpr (std::is_same_v<Type, float>) {
|
||||
this->SetValue(std::strtof(input.c_str(), nullptr));
|
||||
} else {
|
||||
this->SetValue(Type(std::strtoll(input.c_str(), nullptr, 10)));
|
||||
try {
|
||||
if constexpr (std::is_same_v<Type, std::string>) {
|
||||
this->SetValue(input);
|
||||
} else if constexpr (std::is_same_v<Type, std::optional<u32>>) {
|
||||
this->SetValue(u32(std::stoul(input)));
|
||||
} else if constexpr (std::is_same_v<Type, bool>) {
|
||||
this->SetValue(input == "true");
|
||||
} else if constexpr (std::is_same_v<Type, float>) {
|
||||
this->SetValue(std::stof(input));
|
||||
} else {
|
||||
this->SetValue(Type(std::stoll(input)));
|
||||
}
|
||||
} catch (std::invalid_argument&) {
|
||||
this->SetValue(this->GetDefault());
|
||||
} catch (std::out_of_range&) {
|
||||
this->SetValue(this->GetDefault());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue