Instead of loading Defaults.ini underneith Preferences.ini, change the

actual IPreference defaults according to Defaults.ini.  This way, we can
access default values immediately, without having to load and parse a
file.  Since this simply changes the value in the preference, this doesn't
use any more memory.
This commit is contained in:
Glenn Maynard
2006-01-14 03:56:59 +00:00
parent 115e901d82
commit cdf951e589
4 changed files with 50 additions and 3 deletions
+17
View File
@@ -51,6 +51,14 @@ void IPreference::SavePrefsToNode( XNode* pNode )
(*p)->WriteTo( pNode );
}
void IPreference::ReadAllDefaultsFromNode( const XNode* pNode )
{
if( pNode == NULL )
return;
FOREACHS_CONST( IPreference*, *m_Subscribers.m_pSubscribers, p )
(*p)->ReadDefaultFrom( pNode );
}
void IPreference::PushValue( lua_State *L ) const
{
if( LOG )
@@ -101,6 +109,15 @@ void IPreference::WriteTo( XNode* pNode ) const
pNode->AppendAttr( m_sName, ToString() );
}
/* Load our value from the node, and make it the new default. */
void IPreference::ReadDefaultFrom( const XNode* pNode )
{
CString sVal;
if( !pNode->GetAttrValue(m_sName, sVal) )
return;
SetDefaultFromString( sVal );
}
void BroadcastPreferenceChanged( const CString& sPreferenceName )
{
if( MESSAGEMAN )