mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-10-27 01:38:05 +00:00
bring back evil strings
This commit is contained in:
@@ -195,16 +195,22 @@ public:
|
|||||||
this->SetValue(this->GetDefault());
|
this->SetValue(this->GetDefault());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if constexpr (std::is_same_v<Type, std::string>) {
|
try {
|
||||||
this->SetValue(input);
|
if constexpr (std::is_same_v<Type, std::string>) {
|
||||||
} else if constexpr (std::is_same_v<Type, std::optional<u32>>) {
|
this->SetValue(input);
|
||||||
this->SetValue(u32(std::strtoul(input.c_str(), nullptr, 10)));
|
} else if constexpr (std::is_same_v<Type, std::optional<u32>>) {
|
||||||
} else if constexpr (std::is_same_v<Type, bool>) {
|
this->SetValue(u32(std::stoul(input)));
|
||||||
this->SetValue(input == "true");
|
} else if constexpr (std::is_same_v<Type, bool>) {
|
||||||
} else if constexpr (std::is_same_v<Type, float>) {
|
this->SetValue(input == "true");
|
||||||
this->SetValue(std::strtof(input.c_str(), nullptr));
|
} else if constexpr (std::is_same_v<Type, float>) {
|
||||||
} else {
|
this->SetValue(std::stof(input));
|
||||||
this->SetValue(Type(std::strtoll(input.c_str(), nullptr, 10)));
|
} else {
|
||||||
|
this->SetValue(Type(std::stoll(input)));
|
||||||
|
}
|
||||||
|
} catch (std::invalid_argument&) {
|
||||||
|
this->SetValue(this->GetDefault());
|
||||||
|
} catch (std::out_of_range&) {
|
||||||
|
this->SetValue(this->GetDefault());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user