Ticket #3804: gamesetup.js.3.patch
File gamesetup.js.3.patch, 1.9 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/gamesetup/gamesetup.js
873 873 function savePersistMatchSettings() 874 874 { 875 875 let attributes = Engine.ConfigDB_GetValue("user", "persistmatchsettings") == "true" ? g_GameAttributes : {}; 876 877 // Fill players with default AIs 878 for (let i = 0; i < attributes.settings.PlayerData.length; ++i) 879 if (!attributes.settings.PlayerData[i].AI) 880 attributes.settings.PlayerData[i].AI = g_DefaultPlayerData[i].AI; 881 876 882 Engine.WriteJSONFile(g_IsNetworked ? g_MatchSettings_MP : g_MatchSettings_SP, attributes); 877 883 } 878 884 … … 1570 1576 // Player slots are indexed from 0 as Gaia is omitted. 1571 1577 let newPlayerID = newSlot + 1; 1572 1578 let playerID = g_PlayerAssignments[guid].player; 1579 let outdatedAttributes = false; 1573 1580 1574 1581 // Attempt to swap the player or AI occupying the target slot, 1575 1582 // if any, into the slot this player is currently in. … … 1590 1597 1591 1598 // Transfer the AI from the target slot to the current slot. 1592 1599 g_GameAttributes.settings.PlayerData[playerID - 1].AI = g_GameAttributes.settings.PlayerData[newSlot].AI; 1600 1601 // Swap civilizations only if they aren't fixed 1602 if (g_GameAttributes.mapType != "scenario") 1603 { 1604 [g_GameAttributes.settings.PlayerData[playerID - 1].Civ, g_GameAttributes.settings.PlayerData[newSlot].Civ] = 1605 [g_GameAttributes.settings.PlayerData[newSlot].Civ, g_GameAttributes.settings.PlayerData[playerID - 1].Civ]; 1606 1607 if (!g_IsInGuiUpdate) 1608 outdatedAttributes = true; 1609 } 1593 1610 } 1594 1611 1595 1612 if (g_IsNetworked) … … 1599 1616 1600 1617 // Remove AI from this player slot 1601 1618 g_GameAttributes.settings.PlayerData[newSlot].AI = ""; 1619 1620 if (outdatedAttributes) 1621 updateGameAttributes(); 1602 1622 } 1603 1623 1604 1624 function submitChatInput()