mirror of
https://github.com/neoStudiosLCE/neoLegacy.git
synced 2026-06-19 22:02:54 +00:00
replace: biomesEqualsOrMesaPlateau with isSame
we have isSame inside biome, so we dont need to use that function i created because it is useless.
This commit is contained in:
parent
a6d35772bb
commit
dd75cc85e1
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
Loading…
Reference in a new issue