- 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;
});
// Select the point closest to the center
let idx = *biome
.1
.iter()
.min_by_key(|&b| center.distance_squared(uniform_idx_as_vec2(map_size_lg, *b)))
.unwrap();
if biome.1.len() as u32 > 750 {
let name = match biome.0 {
common::terrain::BiomeKind::Forest => format!(
"{}\n{:?}",
NameGen::location(&mut ctx.rng).generate_forest(),
biome.0
),
common::terrain::BiomeKind::Grassland
| common::terrain::BiomeKind::Lake
| common::terrain::BiomeKind::Ocean
| common::terrain::BiomeKind::Mountain
| common::terrain::BiomeKind::Snowland
| common::terrain::BiomeKind::Desert
| common::terrain::BiomeKind::Swamp
| common::terrain::BiomeKind::Jungle
| common::terrain::BiomeKind::Savannah
| common::terrain::BiomeKind::Taiga => format!(
let name = match biome.0 {
common::terrain::BiomeKind::Forest if biome.1.len() as u32 > 750 => format!(
"{}\n{:?}",
NameGen::location(&mut ctx.rng).generate_forest(),
biome.0
),
common::terrain::BiomeKind::Grassland
| common::terrain::BiomeKind::Ocean
| common::terrain::BiomeKind::Mountain
| common::terrain::BiomeKind::Snowland
| common::terrain::BiomeKind::Desert
| common::terrain::BiomeKind::Swamp
| common::terrain::BiomeKind::Jungle
| common::terrain::BiomeKind::Savannah
| common::terrain::BiomeKind::Taiga
if biome.1.len() as u32 > 750 =>
{
format!(
"{}\n{:?}",
NameGen::location(&mut ctx.rng).generate_biome(),
biome.0
),
_ => 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);
}
)
},
common::terrain::BiomeKind::Lake if biome.1.len() as u32 > 200 => {
match ctx.rng.gen_range(0..6) {
0 => format!("{} Lake", NameGen::location(&mut ctx.rng).generate()),
1 => format!("Loch {}", NameGen::location(&mut ctx.rng).generate()),
_ => format!("{} Lake", NameGen::location(&mut ctx.rng).generate()),
}
},
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);
}
}