1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

Mapgen: Fix biome Y calculation regression

BiomeGen::getNextTransitionY(y) did not guarantee the condition (y < biome_y_min)
of the next loop because the function may return the value (biome_y_min - 1).
Hence, the biome was not updated until one Y coordinate after.
This commit is contained in:
SmallJoker 2024-11-28 22:12:24 +01:00 committed by SmallJoker
parent 50928b9759
commit 480eb7d816
5 changed files with 24 additions and 15 deletions

View file

@ -129,7 +129,10 @@ BiomeGenOriginal::BiomeGenOriginal(BiomeManager *biomemgr,
for (size_t i = 0; i < m_bmgr->getNumObjects(); i++) {
Biome *b = (Biome *)m_bmgr->getRaw(i);
values.push_back(b->max_pos.Y);
values.push_back(b->min_pos.Y);
// We scan for biomes from high Y to low Y (top to bottom). Hence,
// biomes effectively transition at (min_pos.Y - 1).
if (b->min_pos.Y > -MAX_MAP_GENERATION_LIMIT)
values.push_back(b->min_pos.Y - 1);
}
std::sort(values.begin(), values.end(), std::greater<>());