Fix GUI errors when a client joins a multiplayer game setup room.

Based on a patch by cwprogger, fixes #2779

This was SVN commit r15802.
This commit is contained in:
Itms
2014-09-25 15:05:10 +00:00
parent b155d4f7e3
commit d7d1607021
2 changed files with 15 additions and 5 deletions
@@ -1033,10 +1033,17 @@ function onGameAttributesChange()
var mapSelectionBox = Engine.GetGUIObjectByName("mapSelection");
mapSelectionBox.selected = mapSelectionBox.list_data.indexOf(mapName);
Engine.GetGUIObjectByName("mapSelectionText").caption = translate(getMapDisplayName(mapName));
var populationCapBox = Engine.GetGUIObjectByName("populationCap");
populationCapBox.selected = populationCapBox.list_data.indexOf(mapSettings.PopulationCap);
var startingResourcesBox = Engine.GetGUIObjectByName("startingResources");
startingResourcesBox.selected = startingResourcesBox.list_data.indexOf(mapSettings.StartingResources);
if (mapSettings.PopulationCap)
{
var populationCapBox = Engine.GetGUIObjectByName("populationCap");
populationCapBox.selected = populationCapBox.list_data.indexOf(mapSettings.PopulationCap);
}
if (mapSettings.StartingResources)
{
var startingResourcesBox = Engine.GetGUIObjectByName("startingResources");
startingResourcesBox.selected = startingResourcesBox.list_data.indexOf(mapSettings.StartingResources);
}
initMapNameList();
}
@@ -146,7 +146,10 @@
size="0 0 100% 100%"
tooltip_style="onscreenToolTip">
<translatableAttribute id="tooltip">Select a map to play on.</translatableAttribute>
<action on="SelectionChange">selectMap(this.list_data[this.selected]);</action>
<action on="SelectionChange">
if (this.list_data[this.selected])
selectMap(this.list_data[this.selected]);
</action>
</object>
</object>