diff --git a/binaries/data/mods/public/gui/gamesetup/gamesetup.js b/binaries/data/mods/public/gui/gamesetup/gamesetup.js
index fd9d9be..166b3a6 100644
a
|
b
|
function loadGameAttributes()
|
715 | 715 | var mapName = attrs.map || ""; |
716 | 716 | var mapSettings = attrs.settings; |
717 | 717 | |
| 718 | g_GameAttributes = attrs; |
| 719 | |
718 | 720 | // Assign new seeds and match id |
719 | 721 | attrs.matchID = Engine.GetMatchID(); |
720 | 722 | mapSettings.Seed = Math.floor(Math.random() * 65536); |
721 | 723 | mapSettings.AISeed = Math.floor(Math.random() * 65536); |
722 | 724 | |
723 | | // TODO: Check new attributes for being semantically correct. |
724 | | g_GameAttributes = attrs; |
| 725 | var aiCodes = [ ai.id for each (ai in g_AIs) ]; |
| 726 | var civListCodes = [ civ.Code for each (civ in g_CivData) if (civ.SelectableInGameSetup !== false) ]; |
| 727 | civListCodes.push("random"); |
| 728 | |
| 729 | var playerData = mapSettings.PlayerData; |
| 730 | if (playerData) |
| 731 | { |
| 732 | for (var i = 0; i < playerData.length; ++i) |
| 733 | { |
| 734 | // Discard previously unassigned/player slots |
| 735 | if (aiCodes.indexOf(playerData[i].AI) < 0) |
| 736 | playerData[i].AI = aiCodes[0]; |
| 737 | |
| 738 | // Validate player civs. |
| 739 | if (civListCodes.indexOf(playerData[i].Civ) <0) |
| 740 | playerData[i].Civ = "random"; |
| 741 | } |
| 742 | } |
| 743 | |
| 744 | // Refresh probably obsoleted/incomplete map data. |
| 745 | var newMapData = loadMapData(mapName); |
| 746 | if (newMapData && newMapData.settings) |
| 747 | { |
| 748 | for (var prop in newMapData.settings) |
| 749 | mapSettings[prop] = newMapData.settings[prop]; |
| 750 | |
| 751 | // Keep player data |
| 752 | if (playerData) |
| 753 | mapSettings.PlayerData = playerData; |
| 754 | } |
725 | 755 | |
726 | 756 | var mapFilterSelection = Engine.GetGUIObjectByName("mapFilterSelection"); |
727 | 757 | mapFilterSelection.selected = mapFilterSelection.list_data.indexOf(attrs.mapFilter); |