Fix ignoring arrays as supported biomes in gamesetup

Fix regression of dc18d94030.
Spotted by: marder
Reviewed by: wraitii
Differential Revision: https://code.wildfiregames.com/D4044
This was SVN commit r25647.
This commit is contained in:
Imarok
2021-06-02 22:03:59 +00:00
parent 455b784f62
commit 94d669c198
@@ -30,6 +30,14 @@ GameSettings.prototype.Attributes.Biome = class Biome extends GameSetting
this.setBiome(this.getLegacySetting(attribs, "Biome"));
}
filterBiome(available)
{
if (typeof available === "string")
return biome => biome.Id.startsWith(available);
return biome => available.indexOf(biome.Id) !== -1;
}
onMapChange()
{
const mapData = this.settings.map.data;
@@ -38,7 +46,7 @@ GameSettings.prototype.Attributes.Biome = class Biome extends GameSetting
if (mapData.settings.SupportedBiomes === this.cachedMapData)
return;
this.cachedMapData = mapData.settings.SupportedBiomes;
this.available = new Set(this.biomes.filter(biome => biome.Id.indexOf(mapData.settings.SupportedBiomes) !== -1)
this.available = new Set(this.biomes.filter(this.filterBiome(mapData.settings.SupportedBiomes))
.map(biome => biome.Id));
this.biome = "random";
}