mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-14 08:54:49 +00:00
Make MapPreview always listen to map changes
When loading a saved game the user can't change the maps but when receiving the initAttributes from the host the map is "changed". Defect introduced inb90280855f. (cherry picked from commit96aa283e6a) Signed-off-by: Itms <itms@wildfiregames.com>
This commit is contained in:
@@ -9,19 +9,19 @@ class MapPreview
|
||||
this.mapInfoName = Engine.GetGUIObjectByName("mapInfoName");
|
||||
this.mapPreview = Engine.GetGUIObjectByName("mapPreview");
|
||||
|
||||
if (isSavedGame)
|
||||
{
|
||||
// Delay the settings registration handler until we have the map cache.
|
||||
setupWindow.controls.gameSettingsController.registerSettingsLoadedHandler(() => {
|
||||
this.renderName();
|
||||
this.renderPreview();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// Delay the settings registration handler until we have the map cache.
|
||||
setupWindow.controls.gameSettingsController.registerSettingsLoadedHandler(
|
||||
this.onSettingsLoaded.bind(this));
|
||||
|
||||
// TODO: Why does onPress not work? CGUI.cpp seems to support it.
|
||||
this.mapPreview.onMouseLeftPress = this.onPress.bind(this, isSavedGame);
|
||||
this.mapPreview.tooltip = this.Tooltip;
|
||||
}
|
||||
|
||||
onSettingsLoaded()
|
||||
{
|
||||
this.renderName();
|
||||
this.renderPreview();
|
||||
g_GameSettings.map.watch(() => this.renderName(), ["map"]);
|
||||
g_GameSettings.mapPreview.watch(() => this.renderPreview(), ["value"]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user