forked from mirrors/0ad
Always update preview in biome and landscape
Introduced in af15d5972d.
Landscape and Biome previews are not updated correctly when reopeneing
gamesetup.
To solve that, remove lastBiome and lastLandscape and always try to
update preview if preview file exists and does not match with current
one.
Differential revision: D3041
Reviewed by: @Freagarach
Fixes: #5785
This was SVN commit r24139.
This commit is contained in:
+5
-12
@@ -7,8 +7,6 @@ GameSettingControls.Biome = class extends GameSettingControlDropdown
|
||||
this.values = undefined;
|
||||
this.biomeValues = undefined;
|
||||
|
||||
this.lastBiome = undefined;
|
||||
|
||||
this.randomItem = {
|
||||
"Id": this.RandomBiomeId,
|
||||
"Title": setStringTags(this.RandomBiome, this.RandomItemTags),
|
||||
@@ -49,7 +47,6 @@ GameSettingControls.Biome = class extends GameSettingControlDropdown
|
||||
else
|
||||
this.values = undefined;
|
||||
|
||||
this.lastBiome = undefined;
|
||||
}
|
||||
|
||||
onGameAttributesChange()
|
||||
@@ -65,17 +62,13 @@ GameSettingControls.Biome = class extends GameSettingControlDropdown
|
||||
this.gameSettingsControl.updateGameAttributes();
|
||||
}
|
||||
|
||||
if (this.lastBiome != g_GameAttributes.settings.Biome)
|
||||
{
|
||||
let biomePreviewFile =
|
||||
basename(g_GameAttributes.map) + "_" +
|
||||
basename(g_GameAttributes.settings.Biome || "") + ".png";
|
||||
let biomePreviewFile =
|
||||
basename(g_GameAttributes.map) + "_" +
|
||||
basename(g_GameAttributes.settings.Biome || "") + ".png";
|
||||
|
||||
if (Engine.TextureExists(this.mapCache.TexturesPath + this.mapCache.PreviewsPath + biomePreviewFile))
|
||||
g_GameAttributes.settings.Preview = biomePreviewFile;
|
||||
if (!g_GameAttributes.settings.Preview || g_GameAttributes.settings.Preview != biomePreviewFile && Engine.TextureExists(this.mapCache.TexturesPath + this.mapCache.PreviewsPath + biomePreviewFile))
|
||||
g_GameAttributes.settings.Preview = biomePreviewFile;
|
||||
|
||||
this.lastBiome = g_GameAttributes.settings.Biome;
|
||||
}
|
||||
}
|
||||
else if (g_GameAttributes.settings.Biome)
|
||||
{
|
||||
|
||||
+4
-8
@@ -5,7 +5,6 @@ GameSettingControls.Landscape = class extends GameSettingControlDropdown
|
||||
super(...args);
|
||||
|
||||
this.values = undefined;
|
||||
this.lastLandscape = undefined;
|
||||
this.mapData = undefined;
|
||||
}
|
||||
|
||||
@@ -44,8 +43,6 @@ GameSettingControls.Landscape = class extends GameSettingControlDropdown
|
||||
else
|
||||
this.values = undefined;
|
||||
|
||||
this.lastLandscape = undefined;
|
||||
|
||||
this.setHidden(!this.values);
|
||||
}
|
||||
|
||||
@@ -69,11 +66,10 @@ GameSettingControls.Landscape = class extends GameSettingControlDropdown
|
||||
this.gameSettingsControl.updateGameAttributes();
|
||||
}
|
||||
|
||||
if (this.lastLandscape != g_GameAttributes.settings.Landscape)
|
||||
{
|
||||
g_GameAttributes.settings.Preview = this.values.Preview[this.values.Id.indexOf(g_GameAttributes.settings.Landscape)];
|
||||
this.lastLandscape = g_GameAttributes.settings.Biome;
|
||||
}
|
||||
let landscapePreview = this.values.Preview[this.values.Id.indexOf(g_GameAttributes.settings.Landscape)];
|
||||
if (!g_GameAttributes.settings.Preview || g_GameAttributes.settings.Preview != landscapePreview)
|
||||
g_GameAttributes.settings.Preview = landscapePreview;
|
||||
|
||||
}
|
||||
else if (g_GameAttributes.settings.Landscape !== undefined)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user