From 8d44405523423112e9237b10523da383828d6814 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 7 Oct 2006 06:26:40 +0000 Subject: [PATCH] use ToString and FromString on invalid value, default to default --- stepmania/src/Preference.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/stepmania/src/Preference.h b/stepmania/src/Preference.h index 3e6a6c86c3..7749fe21a0 100644 --- a/stepmania/src/Preference.h +++ b/stepmania/src/Preference.h @@ -60,10 +60,11 @@ public: LoadDefault(); } - RString ToString() const { return PrefToString( (const BasicType &) m_currentValue ); } + RString ToString() const { return ::ToString( (const BasicType &) m_currentValue ); } void FromString( const RString &s ) { - PrefFromString( s, (BasicType &)m_currentValue ); + if( !::FromString(s, (BasicType &)m_currentValue) ) + m_currentValue = m_defaultValue; if( m_pfnValidate ) m_pfnValidate( m_currentValue ); } @@ -84,7 +85,9 @@ public: } void SetDefaultFromString( const RString &s ) { - PrefFromString( s, (BasicType &)m_defaultValue ); + T def = m_defaultValue; + if( !::FromString(s, (BasicType &)m_defaultValue) ) + m_defaultValue = def; } const T &Get() const