Fix toValue

This commit is contained in:
Phillip Stephens 2020-09-28 21:35:55 -07:00
parent 7fb8bdc602
commit 94e7bacd71
1 changed files with 7 additions and 2 deletions

View File

@ -75,8 +75,8 @@ public:
std::string help() const;
std::string value() const { return m_value; }
template <typename T>
bool toValue(T& value) const { return false; }
template <class T>
bool toValue(T& value) const;
atVec2f toVec2f(bool* isValid = nullptr) const;
template<>
bool toValue(atVec2f& value) const {
@ -121,6 +121,11 @@ public:
}
double toReal(bool* isValid = nullptr) const;
template<>
bool toValue(float& value) const {
bool isValid = false;
value = static_cast<float>(toReal(&isValid));
return isValid;
}
bool toValue(double& value) const {
bool isValid = false;
value = toReal(&isValid);