From 94d669c19815499d973855f27096ed649ef57e63 Mon Sep 17 00:00:00 2001 From: Imarok Date: Wed, 2 Jun 2021 22:03:59 +0000 Subject: [PATCH] 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. --- .../mods/public/gui/gamesettings/attributes/Biome.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/binaries/data/mods/public/gui/gamesettings/attributes/Biome.js b/binaries/data/mods/public/gui/gamesettings/attributes/Biome.js index 05c667b669..6484e6e2a1 100644 --- a/binaries/data/mods/public/gui/gamesettings/attributes/Biome.js +++ b/binaries/data/mods/public/gui/gamesettings/attributes/Biome.js @@ -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"; }