naming behind feature and fix addition overflow

This commit is contained in:
IsseW 2022-05-10 08:03:40 +02:00
parent 4ce05099a6
commit 9abbb0e928
3 changed files with 17 additions and 7 deletions

View File

@ -13,4 +13,6 @@
site2_towns: true, site2_towns: true,
site2_giant_trees: true, site2_giant_trees: true,
wildlife_density: 1.0, wildlife_density: 1.0,
peak_naming: true,
biome_naming: true,
) )

View File

@ -81,10 +81,14 @@ impl Civs {
let rng = ChaChaRng::from_seed(seed_expan::rng_state(seed)); let rng = ChaChaRng::from_seed(seed_expan::rng_state(seed));
let initial_civ_count = initial_civ_count(sim.map_size_lg()); let initial_civ_count = initial_civ_count(sim.map_size_lg());
let mut ctx = GenCtx { sim, rng }; let mut ctx = GenCtx { sim, rng };
info!("starting peak naming"); if index.features().peak_naming {
this.name_peaks(&mut ctx); info!("starting peak naming");
info!("starting biome naming"); this.name_peaks(&mut ctx);
this.name_biomes(&mut ctx); }
if index.features().biome_naming {
info!("starting biome naming");
this.name_biomes(&mut ctx);
}
for _ in 0..ctx.sim.get_size().product() / 10_000 { for _ in 0..ctx.sim.get_size().product() / 10_000 {
this.generate_cave(&mut ctx); this.generate_cave(&mut ctx);
@ -775,9 +779,11 @@ impl Civs {
let center = biome let center = biome
.1 .1
.iter() .iter()
.map(|b| uniform_idx_as_vec2(map_size_lg, *b)) .map(|b| {
.sum::<Vec2<i32>>() uniform_idx_as_vec2(map_size_lg, *b).as_::<f32>() / biome.1.len() as f32
/ biome.1.len() as i32; })
.sum::<Vec2<f32>>()
.as_::<i32>();
// Select the point closest to the center // Select the point closest to the center
let idx = *biome let idx = *biome
.1 .1

View File

@ -91,6 +91,8 @@ pub struct Features {
pub site2_giant_trees: bool, pub site2_giant_trees: bool,
// 1.0 is the default wildlife density // 1.0 is the default wildlife density
pub wildlife_density: f32, pub wildlife_density: f32,
pub peak_naming: bool,
pub biome_naming: bool,
} }
impl assets::Asset for Features { impl assets::Asset for Features {