diff --git a/Minecraft.World/Biome.cpp b/Minecraft.World/Biome.cpp index 499afecf..46d13663 100644 --- a/Minecraft.World/Biome.cpp +++ b/Minecraft.World/Biome.cpp @@ -521,8 +521,9 @@ void Biome::buildSurfaceAtDefault(Level *level, Random *random, byte* chunkBlock bool Biome::isSame(const Biome* other) const { + if (this == other) return true; if (!other) return false; - return id == other->id; + return this->getBaseBiomeId() == other->getBaseBiomeId(); } int Biome::getTemperatureCategory() const diff --git a/Minecraft.World/Layer.cpp b/Minecraft.World/Layer.cpp index bfa84f00..84588c8b 100644 --- a/Minecraft.World/Layer.cpp +++ b/Minecraft.World/Layer.cpp @@ -231,19 +231,13 @@ bool Layer::isOcean(int biomeId) bool Layer::isSame(int biomeIdA, int biomeIdB) { if (biomeIdA == biomeIdB) { return true; - } else { - Biome* biome = Biome::getBiome(biomeIdA); - Biome* biome2 = Biome::getBiome(biomeIdB); - if (biome != nullptr && biome2 != nullptr) { - if (biome != Biome::mesaPlateauF && biome != Biome::mesaPlateau) { - return biome == biome2 || biome->getBaseBiomeId() == biome2->getBaseBiomeId(); - } else { - return biome2 == Biome::mesaPlateauF || biome2 == Biome::mesaPlateau; - } - } else { - return false; - } } + Biome* biome = Biome::getBiome(biomeIdA); + Biome* biome2 = Biome::getBiome(biomeIdB); + if (biome != nullptr && biome2 != nullptr) { + return biome->isSame(biome2); + } + return false; } diff --git a/Minecraft.World/RegionHillsLayer.cpp b/Minecraft.World/RegionHillsLayer.cpp index c90ebb20..2bcee02a 100644 --- a/Minecraft.World/RegionHillsLayer.cpp +++ b/Minecraft.World/RegionHillsLayer.cpp @@ -25,10 +25,6 @@ void RegionHillsLayer::init(int64_t seed) } -bool RegionHillsLayer::biomesEqualOrMesaPlateau(int a, int b) -{ - return a == b; -} intArray RegionHillsLayer::getArea(int xo, int yo, int w, int h) @@ -143,6 +139,10 @@ intArray RegionHillsLayer::getArea(int xo, int yo, int w, int h) i1 = Biome::forest->id; } } + else if (k == Biome::mesaPlateauF->id) + { + i1 = Biome::mesaPlateau->id; + } @@ -171,10 +171,10 @@ intArray RegionHillsLayer::getArea(int xo, int yo, int w, int h) int _s = b[x + 1 + (y + 1 + 1) * (w + 2)]; int neighbours = 0; - if (biomesEqualOrMesaPlateau(_n, k)) ++neighbours; - if (biomesEqualOrMesaPlateau(_e, k)) ++neighbours; - if (biomesEqualOrMesaPlateau(_w, k)) ++neighbours; - if (biomesEqualOrMesaPlateau(_s, k)) ++neighbours; + if (isSame(_n, k)) ++neighbours; + if (isSame(_e, k)) ++neighbours; + if (isSame(_w, k)) ++neighbours; + if (isSame(_s, k)) ++neighbours; result[x + y * w] = (neighbours >= 3) ? i1 : k; } diff --git a/Minecraft.World/RegionHillsLayer.h b/Minecraft.World/RegionHillsLayer.h index 4cbd8568..31afaaf6 100644 --- a/Minecraft.World/RegionHillsLayer.h +++ b/Minecraft.World/RegionHillsLayer.h @@ -13,7 +13,4 @@ public: virtual void init(int64_t seed) override; virtual intArray getArea(int xo, int yo, int w, int h) override; - -private: - static bool biomesEqualOrMesaPlateau(int a, int b); }; \ No newline at end of file