Ticket #3883: persist_match_settings_v2.patch
File persist_match_settings_v2.patch, 1.7 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/gamesetup/gamesetup.js
863 863 if (Engine.ConfigDB_GetValue("user", "persistmatchsettings") != "true") 864 864 return; 865 865 866 // Load file 866 867 let settingsFile = g_IsNetworked ? g_MatchSettings_MP : g_MatchSettings_SP; 867 868 if (!Engine.FileExists(settingsFile)) 868 869 return; … … 871 872 if (!attrs || !attrs.settings) 872 873 return; 873 874 875 // Find which settings can be changed by the user 876 let allowedSettings = ["PlayerData"]; 877 878 if (attrs.mapType == "skirmish" || attrs.mapType == "random") 879 allowedSettings = allowedSettings.concat(["GameType", "VictoryScripts", "WonderDuration", "PopulationCap", "Ceasefire", "StartingResources", "RevealMap", "LockTeams", "ExploreMap", "DisableTreasures"]); 880 881 if (attrs.mapType == "random") 882 allowedSettings = allowedSettings.concat(["Size"]); 883 884 attrs.settings.RatingEnabled = Engine.HasXmppClient(); 885 Engine.SetRankedGame(attrs.settings.RatingEnabled); 886 887 if (g_IsNetworked && !attrs.settings.RatingEnabled) 888 allowedSettings.push("CheatsEnabled"); 889 890 // Only load settings which can be changed by the user 891 for (let prop in attrs.settings) 892 if (!prop in allowedSettings) 893 delete attrs.settings[prop]; 894 895 // Restore valid matchsettings 874 896 g_IsInGuiUpdate = true; 875 897 876 898 let mapName = attrs.map || ""; … … 908 930 // Reload, as the maptype or mapfilter might have changed 909 931 initMapNameList(); 910 932 911 g_GameAttributes.settings.RatingEnabled = Engine.HasXmppClient();912 Engine.SetRankedGame(g_GameAttributes.settings.RatingEnabled);913 914 933 updateGUIObjects(); 915 934 } 916 935