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:
@@ -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 )
|
||||
|
||||
Reference in New Issue
Block a user