mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
change algorithm for biome-naming to weigh chunks evenly
This commit is contained in:
parent
9f0664c73b
commit
8f0ad56d25
@ -657,13 +657,12 @@ impl Civs {
|
||||
};
|
||||
if let Some(name) = name {
|
||||
// find average center of the biome
|
||||
let mut biomes = biome.1.iter();
|
||||
// There is always at least 1 biome
|
||||
let mut center = uniform_idx_as_vec2(map_size_lg, *biomes.next().unwrap());
|
||||
biomes.for_each(|b| {
|
||||
center += uniform_idx_as_vec2(map_size_lg, *b);
|
||||
center /= 2;
|
||||
});
|
||||
let center = biome
|
||||
.1
|
||||
.iter()
|
||||
.map(|b| uniform_idx_as_vec2(map_size_lg, *b))
|
||||
.sum::<Vec2<i32>>()
|
||||
/ biome.1.len() as i32;
|
||||
// Select the point closest to the center
|
||||
let idx = *biome
|
||||
.1
|
||||
|
Loading…
Reference in New Issue
Block a user