Fix MP gamesetup issues with mapfilter
- Settings weren't sent to the server when mapfilters change. - Because of ordering issues, the 'multiplayer' mapfilter would be activated at the wrong time and things would go haywire. - Likewise, selecting a non-default map with a non-default filter wouldn't work well. Fixes #6208 Differential Revision: https://code.wildfiregames.com/D4111 This was SVN commit r25731.
This commit is contained in:
parent
70f2ac6788
commit
09a33b6626
@ -94,15 +94,16 @@ 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()
|
||||
@ -159,15 +160,18 @@ 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);
|
||||
}
|
||||
|
||||
this.parseSettings(message.data.initAttribs);
|
||||
else
|
||||
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 (let handler of this.settingsChangeHandlers)
|
||||
for (const handler of this.settingsChangeHandlers)
|
||||
handler();
|
||||
}
|
||||
|
||||
@ -186,9 +190,9 @@ class GameSettingsController
|
||||
*/
|
||||
parseSettings(settings)
|
||||
{
|
||||
g_GameSettings.fromInitAttributes(settings);
|
||||
if (settings.guiData)
|
||||
this.guiData.Deserialize(settings.guiData);
|
||||
g_GameSettings.fromInitAttributes(settings);
|
||||
}
|
||||
|
||||
setLoading(loading)
|
||||
|
@ -74,6 +74,7 @@ GameSettingControls.MapFilter = class MapFilter extends GameSettingControlDropdo
|
||||
onSelectionChange(itemIdx)
|
||||
{
|
||||
this.gameSettingsController.guiData.mapFilter.filter = this.values.Name[itemIdx];
|
||||
this.gameSettingsController.setNetworkInitAttributes();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -37,6 +37,13 @@ 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();
|
||||
@ -59,13 +66,6 @@ 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;
|
||||
|
||||
{
|
||||
let values =
|
||||
const values =
|
||||
this.mapFilters.getFilteredMaps(
|
||||
g_GameSettings.map.type,
|
||||
this.gameSettingsController.guiData.mapFilter.filter,
|
||||
|
Loading…
Reference in New Issue
Block a user