- make individual size thresholds for biome name generation to include small lakes

- add original Lake naming pattern, partly (no water_alt check)
This commit is contained in:
floppy 2022-01-17 16:02:52 +01:00
parent ced1a82824
commit 609d23ae4f

View File

@ -517,43 +517,57 @@ impl Civs {
center /= 2; center /= 2;
}); });
// Select the point closest to the center // Select the point closest to the center
let idx = *biome let idx = *biome
.1 .1
.iter() .iter()
.min_by_key(|&b| center.distance_squared(uniform_idx_as_vec2(map_size_lg, *b))) .min_by_key(|&b| center.distance_squared(uniform_idx_as_vec2(map_size_lg, *b)))
.unwrap(); .unwrap();
if biome.1.len() as u32 > 750 { let name = match biome.0 {
let name = match biome.0 { common::terrain::BiomeKind::Forest if biome.1.len() as u32 > 750 => format!(
common::terrain::BiomeKind::Forest => format!( "{}\n{:?}",
"{}\n{:?}", NameGen::location(&mut ctx.rng).generate_forest(),
NameGen::location(&mut ctx.rng).generate_forest(), biome.0
biome.0 ),
), common::terrain::BiomeKind::Grassland
common::terrain::BiomeKind::Grassland | common::terrain::BiomeKind::Ocean
| common::terrain::BiomeKind::Lake | common::terrain::BiomeKind::Mountain
| common::terrain::BiomeKind::Ocean | common::terrain::BiomeKind::Snowland
| common::terrain::BiomeKind::Mountain | common::terrain::BiomeKind::Desert
| common::terrain::BiomeKind::Snowland | common::terrain::BiomeKind::Swamp
| common::terrain::BiomeKind::Desert | common::terrain::BiomeKind::Jungle
| common::terrain::BiomeKind::Swamp | common::terrain::BiomeKind::Savannah
| common::terrain::BiomeKind::Jungle | common::terrain::BiomeKind::Taiga
| common::terrain::BiomeKind::Savannah if biome.1.len() as u32 > 750 =>
| common::terrain::BiomeKind::Taiga => format!( {
format!(
"{}\n{:?}", "{}\n{:?}",
NameGen::location(&mut ctx.rng).generate_biome(), NameGen::location(&mut ctx.rng).generate_biome(),
biome.0 biome.0
), )
_ => String::new(), },
}; common::terrain::BiomeKind::Lake if biome.1.len() as u32 > 200 => {
let id = self.pois.insert(PointOfInterest { match ctx.rng.gen_range(0..6) {
name, 0 => format!("{} Lake", NameGen::location(&mut ctx.rng).generate()),
loc: uniform_idx_as_vec2(map_size_lg, idx), 1 => format!("Loch {}", NameGen::location(&mut ctx.rng).generate()),
kind: PoiKind::Biome(biome.1.len() as u32), _ => format!("{} Lake", NameGen::location(&mut ctx.rng).generate()),
}); }
for chunk in biome.1 { },
ctx.sim.chunks[chunk].poi = Some(id); common::terrain::BiomeKind::Lake if biome.1.len() as u32 > 10 => {
} match ctx.rng.gen_range(0..4) {
0 => format!("{} Pool", NameGen::location(&mut ctx.rng).generate()),
1 => format!("{} Well", NameGen::location(&mut ctx.rng).generate()),
_ => format!("{} Pond", NameGen::location(&mut ctx.rng).generate()),
}
},
_ => String::new(),
};
let id = self.pois.insert(PointOfInterest {
name,
loc: uniform_idx_as_vec2(map_size_lg, idx),
kind: PoiKind::Biome(biome.1.len() as u32),
});
for chunk in biome.1 {
ctx.sim.chunks[chunk].poi = Some(id);
} }
} }