Ticket #3883: roughsketch.patch
File roughsketch.patch, 2.0 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/gamesetup/gamesetup.js
function loadMapData(name) 817 817 function loadPersistMatchSettings() 818 818 { 819 819 if (Engine.ConfigDB_GetValue("user", "persistmatchsettings") != "true") 820 820 return; 821 821 822 // Load file 822 823 let settingsFile = g_IsNetworked ? g_MatchSettings_MP : g_MatchSettings_SP; 823 824 if (!Engine.FileExists(settingsFile)) 824 825 return; 825 826 826 827 let attrs = Engine.ReadJSONFile(settingsFile); 827 828 if (!attrs || !attrs.settings) 828 829 return; 829 830 831 // Find which settings can be changed by the user 832 let allowedSettings = ["GameSpeed", "map", "maptype", "mapfilter"]; 833 834 if (attrs.mapType == "skirmish" || attrs.mapType == "skirmish") 835 allowedSettings = allowedSettings.concat(["victorycondition", "population cap", "starting resources", "ceasefire", "revealed map", "explored map", "disable treasures", "teams locked"]); 836 837 if (attrs.mapType == "random") 838 allowedSettings = allowedSettings.concat(["mapsize", "numPlayers"]); 839 840 attrs.settings.RatingEnabled = Engine.HasXmppClient(); 841 Engine.SetRankedGame(attrs.settings.RatingEnabled); 842 843 if (g_IsNetworked && !attrs.settings.RatingEnabled) 844 allowedSettings.push("cheats"); 845 846 // Only load settings which can be changed by the user 847 for (let prop in attrs) 848 if (!prop in allowedSettings) 849 delete attrs[prop]; 850 851 // Restore valid matchsettings 830 852 g_IsInGuiUpdate = true; 831 853 832 854 let mapName = attrs.map || ""; 833 855 let mapSettings = attrs.settings; 834 856 … … function loadPersistMatchSettings() 862 884 sanitizePlayerData(mapSettings.PlayerData); 863 885 864 886 // Reload, as the maptype or mapfilter might have changed 865 887 initMapNameList(); 866 888 867 g_GameAttributes.settings.RatingEnabled = Engine.HasXmppClient();868 Engine.SetRankedGame(g_GameAttributes.settings.RatingEnabled);869 870 889 updateGUIObjects(); 871 890 } 872 891 873 892 function savePersistMatchSettings() 874 893 {