Ticket #3805: resetcivsbutton.patch

File resetcivsbutton.patch, 1.8 KB (added by Sandarac, 8 years ago)
  • gamesetup.js

     
    13811381
    13821382    Engine.GetGUIObjectByName("enableCheats").enabled = !mapSettings.RatingEnabled;
    13831383    Engine.GetGUIObjectByName("lockTeams").enabled = !mapSettings.RatingEnabled;
     1384    Engine.GetGUIObjectByName("resetCivilizations").hidden = g_GameAttributes.mapType == "scenario" || !g_IsController;
    13841385
    13851386    // Mapsize completely hidden for non-random maps
    13861387    let isRandom = g_GameAttributes.mapType == "random";
     
    17991800    Engine.GetGUIObjectByName("moreOptions").hidden = !show;
    18001801}
    18011802
     1803function resetCivilizations()
     1804{
     1805    for (let i in g_GameAttributes.settings.PlayerData)
     1806    {
     1807        g_GameAttributes.settings.PlayerData[i].Civ = "random";
     1808    }
     1809    updateGUIObjects()
     1810}
     1811
    18021812function toggleReady()
    18031813{
    18041814    g_IsReady = !g_IsReady;
  • gamesetup.xml

     
    265265                    <translatableAttribute id="tooltip">See more game options</translatableAttribute>
    266266                    <action on="Press">showMoreOptions(true);</action>
    267267                </object>
    268 
     268               
     269                <!-- Reset Civilizations Button -->
     270                <object
     271                    name="resetCivilizations"
     272                    type="button"
     273                    style="StoneButton"
     274                    size="69%-120 0 69% 28"
     275                    tooltip_style="onscreenToolTip"
     276                >
     277                    <translatableAttribute id="caption">Reset Civilizations</translatableAttribute>
     278                    <translatableAttribute id="tooltip">Reset any civilizations that have been selected to the default (random)</translatableAttribute>
     279                    <action on="Press">resetCivilizations();</action>
     280                </object>
     281               
    269282            <!-- End Options -->
    270283            </object>
    271284