forked from mirrors/0ad
Revert parts of 09a33b6626
There is an issue when no matchsettings.json is present. This keeps the network synchronisation fix, that worked. This was SVN commit r25739.
This commit is contained in:
@@ -94,16 +94,15 @@ class GameSettingsController
|
||||
g_GameSettings.playerAI.get(g_PlayerAssignments[guid].player - 1))
|
||||
g_GameSettings.playerAI.set(g_PlayerAssignments[guid].player - 1, undefined);
|
||||
|
||||
for (const handler of this.settingsLoadedHandlers)
|
||||
handler();
|
||||
|
||||
this.updateLayout();
|
||||
this.setNetworkInitAttributes();
|
||||
|
||||
// If we are the controller, we are done loading.
|
||||
if (hotloadData || !g_IsNetworked || g_IsController)
|
||||
{
|
||||
for (const handler of this.settingsLoadedHandlers)
|
||||
handler();
|
||||
this.setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
onClientJoin()
|
||||
@@ -160,18 +159,15 @@ class GameSettingsController
|
||||
// Ignore initial updates if we've already received settings.
|
||||
if (!this.loading)
|
||||
return;
|
||||
this.parseSettings(message.data.initAttribs);
|
||||
for (const handler of this.settingsLoadedHandlers)
|
||||
handler();
|
||||
this.setLoading(false);
|
||||
}
|
||||
else
|
||||
this.parseSettings(message.data.initAttribs);
|
||||
|
||||
this.parseSettings(message.data.initAttribs);
|
||||
|
||||
// This assumes that messages aren't sent spuriously without changes
|
||||
// (which is generally fair), but technically it would be good
|
||||
// to check if the new data is different from the previous data.
|
||||
for (const handler of this.settingsChangeHandlers)
|
||||
for (let handler of this.settingsChangeHandlers)
|
||||
handler();
|
||||
}
|
||||
|
||||
@@ -190,9 +186,9 @@ class GameSettingsController
|
||||
*/
|
||||
parseSettings(settings)
|
||||
{
|
||||
g_GameSettings.fromInitAttributes(settings);
|
||||
if (settings.guiData)
|
||||
this.guiData.Deserialize(settings.guiData);
|
||||
g_GameSettings.fromInitAttributes(settings);
|
||||
}
|
||||
|
||||
setLoading(loading)
|
||||
|
||||
+8
-8
@@ -37,13 +37,6 @@ GameSettingControls.MapSelection = class MapSelection extends GameSettingControl
|
||||
this.gameSettingsController.guiData.mapFilter.watch(() => this.updateMapList(), ["filter"]);
|
||||
|
||||
this.updateMapList();
|
||||
|
||||
// We can end up with incorrect settings in various situations.
|
||||
if (this.values.file.indexOf(g_GameSettings.map.map) === -1)
|
||||
{
|
||||
g_GameSettings.map.selectMap(this.values.file[this.values.Default]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.render();
|
||||
@@ -66,6 +59,13 @@ GameSettingControls.MapSelection = class MapSelection extends GameSettingControl
|
||||
if (!this.values)
|
||||
return;
|
||||
|
||||
// We can end up with incorrect map selection when dependent settings change.
|
||||
if (this.values.file.indexOf(g_GameSettings.map.map) === -1)
|
||||
{
|
||||
g_GameSettings.map.selectMap(this.values.file[this.values.Default]);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setSelectedValue(g_GameSettings.map.map);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ GameSettingControls.MapSelection = class MapSelection extends GameSettingControl
|
||||
return;
|
||||
|
||||
{
|
||||
const values =
|
||||
let values =
|
||||
this.mapFilters.getFilteredMaps(
|
||||
g_GameSettings.map.type,
|
||||
this.gameSettingsController.guiData.mapFilter.filter,
|
||||
|
||||
Reference in New Issue
Block a user