1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +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

@ -93,11 +93,10 @@ void TestMapgen::testBiomeGen(IGameDef *gamedef)
const char *name;
s16 next_y;
} expected_biomes[] = {
{ MAX_MAP_GENERATION_LIMIT, "deciduous_forest", 1 },
// ^ FIXME: next_y should be 0 (min_pos.Y - 1)
{ MAX_MAP_GENERATION_LIMIT, "deciduous_forest", 0 },
{ 1, "deciduous_forest", 0 },
{ 0, "deciduous_forest_shore", -MAX_MAP_GENERATION_LIMIT },
{ -100, "deciduous_forest_shore", -MAX_MAP_GENERATION_LIMIT },
{ 0, "deciduous_forest_shore", S16_MIN },
{ -100, "deciduous_forest_shore", S16_MIN },
};
for (const auto expected : expected_biomes) {
Biome *biome = biomegen->getBiomeAtIndex(