mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-28 17:13:12 +00:00
allows the user to restore the default game options, refs #3737
This was SVN commit r17739.
This commit is contained in:
@@ -42,6 +42,25 @@ bool JSI_ConfigDB::GetConfigNamespace(const std::wstring& cfgNsString, EConfigNa
|
||||
return true;
|
||||
}
|
||||
|
||||
bool JSI_ConfigDB::HasChanges(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& cfgNsString)
|
||||
{
|
||||
EConfigNamespace cfgNs;
|
||||
if (!GetConfigNamespace(cfgNsString, cfgNs))
|
||||
return false;
|
||||
|
||||
return g_ConfigDB.HasChanges(cfgNs);
|
||||
}
|
||||
|
||||
bool JSI_ConfigDB::SetChanges(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& cfgNsString, bool value)
|
||||
{
|
||||
EConfigNamespace cfgNs;
|
||||
if (!GetConfigNamespace(cfgNsString, cfgNs))
|
||||
return false;
|
||||
|
||||
g_ConfigDB.SetChanges(cfgNs, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string JSI_ConfigDB::GetValue(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& cfgNsString, const std::string& name)
|
||||
{
|
||||
EConfigNamespace cfgNs;
|
||||
@@ -63,6 +82,16 @@ bool JSI_ConfigDB::CreateValue(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), c
|
||||
return true;
|
||||
}
|
||||
|
||||
bool JSI_ConfigDB::RemoveValue(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& cfgNsString, const std::string& name)
|
||||
{
|
||||
EConfigNamespace cfgNs;
|
||||
if (!GetConfigNamespace(cfgNsString, cfgNs))
|
||||
return false;
|
||||
|
||||
g_ConfigDB.RemoveValue(cfgNs, name);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool JSI_ConfigDB::WriteFile(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& cfgNsString, const Path& path)
|
||||
{
|
||||
EConfigNamespace cfgNs;
|
||||
@@ -105,8 +134,11 @@ bool JSI_ConfigDB::SetFile(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const
|
||||
|
||||
void JSI_ConfigDB::RegisterScriptFunctions(ScriptInterface& scriptInterface)
|
||||
{
|
||||
scriptInterface.RegisterFunction<bool, std::wstring, &JSI_ConfigDB::HasChanges>("ConfigDB_HasChanges");
|
||||
scriptInterface.RegisterFunction<bool, std::wstring, bool, &JSI_ConfigDB::SetChanges>("ConfigDB_SetChanges");
|
||||
scriptInterface.RegisterFunction<std::string, std::wstring, std::string, &JSI_ConfigDB::GetValue>("ConfigDB_GetValue");
|
||||
scriptInterface.RegisterFunction<bool, std::wstring, std::string, std::string, &JSI_ConfigDB::CreateValue>("ConfigDB_CreateValue");
|
||||
scriptInterface.RegisterFunction<bool, std::wstring, std::string, &JSI_ConfigDB::RemoveValue>("ConfigDB_RemoveValue");
|
||||
scriptInterface.RegisterFunction<bool, std::wstring, Path, &JSI_ConfigDB::WriteFile>("ConfigDB_WriteFile");
|
||||
scriptInterface.RegisterFunction<bool, std::wstring, std::string, std::string, Path, &JSI_ConfigDB::WriteValueToFile>("ConfigDB_WriteValueToFile");
|
||||
scriptInterface.RegisterFunction<bool, std::wstring, Path, &JSI_ConfigDB::SetFile>("ConfigDB_SetFile");
|
||||
|
||||
Reference in New Issue
Block a user