(d9779ffb1) Don't reset the language when resetting settings to defaults

This commit is contained in:
Joonas Rikkonen
2019-05-18 17:24:20 +03:00
parent 4bc665cc56
commit 5fdc5f65f3
2 changed files with 22 additions and 19 deletions

View File

@@ -755,7 +755,7 @@ namespace Barotrauma
OnClicked = (button, data) =>
{
// TODO: add a prompt
LoadDefaultConfig();
LoadDefaultConfig(setLanguage: false);
CheckBindings(true);
RefreshItemMessages();
ApplySettings();

View File

@@ -337,24 +337,6 @@ namespace Barotrauma
keyMapping[(int)InputType.SelectNextCharacter] = new KeyOrMouse(Keys.Z);
keyMapping[(int)InputType.SelectPreviousCharacter] = new KeyOrMouse(Keys.X);
}
}
#region Load DefaultConfig
private void LoadDefaultConfig()
{
XDocument doc = XMLExtensions.TryLoadXml(savePath);
Language = doc.Root.GetAttributeString("language", "English");
MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", "");
AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true);
WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false);
VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false);
SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false);
QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", "");
if (legacy)
{
@@ -433,6 +415,17 @@ namespace Barotrauma
}
}
#region Load DefaultConfig
private void LoadDefaultConfig(bool setLanguage = true)
{
XDocument doc = XMLExtensions.TryLoadXml(savePath);
if (setLanguage || string.IsNullOrEmpty(Language))
{
Language = doc.Root.GetAttributeString("language", "English");
}
}
#region Load DefaultConfig
private void LoadDefaultConfig()
{
@@ -450,6 +443,16 @@ namespace Barotrauma
QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", "");
MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", "");
AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true);
WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false);
VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false);
SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false);
QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", "");
if (doc == null)
{
GraphicsWidth = 1024;