[Project64] Some code refactoring to CSettingTypeApplication

This commit is contained in:
zilmar 2018-03-28 19:36:10 +11:00
parent 9e92381a2d
commit 88a824be60
1 changed files with 3 additions and 24 deletions

View File

@ -170,14 +170,7 @@ bool CSettingTypeApplication::Load(uint32_t /*Index*/, uint32_t & Value) const
bool bRes = m_SettingsIniFile->GetNumber(SectionName(), m_KeyNameIdex.c_str(), Value, Value); bool bRes = m_SettingsIniFile->GetNumber(SectionName(), m_KeyNameIdex.c_str(), Value, Value);
if (!bRes && m_DefaultSetting != Default_None) if (!bRes && m_DefaultSetting != Default_None)
{ {
if (m_DefaultSetting == Default_Constant) Value = m_DefaultSetting == Default_Constant ? m_DefaultValue: g_Settings->LoadDword(m_DefaultSetting);
{
Value = m_DefaultValue;
}
else
{
g_Settings->LoadDword(m_DefaultSetting, Value);
}
} }
return bRes; return bRes;
} }
@ -217,14 +210,7 @@ void CSettingTypeApplication::LoadDefault(uint32_t /*Index*/, uint32_t & Value)
{ {
if (m_DefaultSetting != Default_None) if (m_DefaultSetting != Default_None)
{ {
if (m_DefaultSetting == Default_Constant) Value = m_DefaultSetting == Default_Constant ? m_DefaultValue : g_Settings->LoadDword(m_DefaultSetting);
{
Value = m_DefaultValue;
}
else
{
g_Settings->LoadDword(m_DefaultSetting, Value);
}
} }
} }
@ -232,14 +218,7 @@ void CSettingTypeApplication::LoadDefault(uint32_t /*Index*/, std::string & Valu
{ {
if (m_DefaultSetting != Default_None) if (m_DefaultSetting != Default_None)
{ {
if (m_DefaultSetting == Default_Constant) Value = m_DefaultSetting == Default_Constant ? m_DefaultStr : g_Settings->LoadStringVal(m_DefaultSetting);
{
Value = m_DefaultStr;
}
else
{
g_Settings->LoadStringVal(m_DefaultSetting, Value);
}
} }
} }