remove existing setup file content that is same as default

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6923 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 1dd2305c763f1f3fcf40f79a7738df789b7f9a84
Former-commit-id: 0a4ac86dd9eebe8d7870c28be72a67d6ed25eb49
This commit is contained in:
iobyte 2020-04-16 03:19:25 +00:00
parent 9c44c3b923
commit ad0f024a93

View file

@ -504,7 +504,12 @@ void CarSetupMenu::storeSettings()
GfLogInfo("Created car setup file: %s\n", ossCarSetupFileName.str().c_str());
}
else
{
// Remove existing content.
GfParmClean(hparmCarSetup);
GfLogInfo("Opened car setup file: %s\n", ossCarSetupFileName.str().c_str());
}
// Store all items.
for (size_t page = 0; page < items.size(); ++page)
@ -522,18 +527,6 @@ void CarSetupMenu::storeSettings()
GfParmSetNum(hparmCarSetup, att.section.c_str(), att.param.c_str(),
att.units.c_str(), att.value, att.minValue, att.maxValue);
}
else
{
// Remove it if it is the same as default.
if (GfParmExistsParam(hparmCarSetup, att.section.c_str(), att.param.c_str()))
{
// FIXME This crashes when the last section is deleted so set
// the parameter to its default value.
//GfParmRemove(hparmCarSetup, att.section.c_str(), att.param.c_str());
GfParmSetNum(hparmCarSetup, att.section.c_str(), att.param.c_str(),
att.units.c_str(), att.value, att.minValue, att.maxValue);
}
}
}
else if (att.type == "combo")
{
@ -542,18 +535,6 @@ void CarSetupMenu::storeSettings()
GfParmSetStrAndIn(hparmCarSetup, att.section.c_str(), att.param.c_str(),
att.strValue.c_str(), att.in);
}
else
{
// Remove it if it is the same as default.
if (GfParmExistsParam(hparmCarSetup, att.section.c_str(), att.param.c_str()))
{
// FIXME This crashes when the last section is deleted so set
// the parameter to its default value.
//GfParmRemove(hparmCarSetup, att.section.c_str(), att.param.c_str());
GfParmSetStrAndIn(hparmCarSetup, att.section.c_str(), att.param.c_str(),
att.strValue.c_str(), att.in);
}
}
}
}
}