mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-09-12 22:09:18 -04:00
Remove zero chance biomes before constructing the biome properties tree.
fixes #766
This commit is contained in:
parent
7b4461ad00
commit
116d7b5e99
@ -594,7 +594,19 @@ pub fn register(id: []const u8, paletteId: u32, zon: ZonElement) void {
|
|||||||
pub fn finishLoading() void {
|
pub fn finishLoading() void {
|
||||||
std.debug.assert(!finishedLoading);
|
std.debug.assert(!finishedLoading);
|
||||||
finishedLoading = true;
|
finishedLoading = true;
|
||||||
byTypeBiomes = TreeNode.init(main.globalAllocator, biomes.items, 0);
|
var nonZeroBiomes: usize = biomes.items.len;
|
||||||
|
for(0..biomes.items.len) |_i| {
|
||||||
|
const i = biomes.items.len - _i - 1;
|
||||||
|
if(biomes.items[i].chance == 0) {
|
||||||
|
nonZeroBiomes -= 1;
|
||||||
|
const biome = biomes.items[i];
|
||||||
|
for(i..nonZeroBiomes) |j| {
|
||||||
|
biomes.items[j] = biomes.items[j + 1];
|
||||||
|
}
|
||||||
|
biomes.items[nonZeroBiomes] = biome;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
byTypeBiomes = TreeNode.init(main.globalAllocator, biomes.items[0..nonZeroBiomes], 0);
|
||||||
for(biomes.items) |*biome| {
|
for(biomes.items) |*biome| {
|
||||||
biomesById.put(biome.id, biome) catch unreachable;
|
biomesById.put(biome.id, biome) catch unreachable;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user