- add size threshold for biomes to name, to exclude mini-biomes from clogging the map.

- fmt, clippy
This commit is contained in:
floppy 2022-01-17 11:19:34 +01:00
parent 18c434c613
commit ced1a82824
2 changed files with 39 additions and 27 deletions

View File

@ -523,27 +523,37 @@ impl Civs {
.iter()
.min_by_key(|&b| center.distance_squared(uniform_idx_as_vec2(map_size_lg, *b)))
.unwrap();
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!("{}\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);
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!(
"{}\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);
}
}
}

View File

@ -89,15 +89,17 @@ impl<'a, R: Rng> NameGen<'a, R> {
pub fn generate_forest(self) -> String {
let cons = vec![
"green", "moss", "ever", "briar", "thorn", "oak", "deep", "moon", "star", "sun", "bright", "glare",
"fair", "calm", "mistral", "whisper", "clover", "hollow", "spring", "morrow", "dim", "dusk", "dawn", "night",
"shimmer", "silver", "gold", "whisper", "fern", "quiet", "still", "gleam", "wild", "blind", "swift",
"green", "moss", "ever", "briar", "thorn", "oak", "deep", "moon", "star", "sun",
"bright", "glare", "fair", "calm", "mistral", "whisper", "clover", "hollow", "spring",
"morrow", "dim", "dusk", "dawn", "night", "shimmer", "silver", "gold", "whisper",
"fern", "quiet", "still", "gleam", "wild", "blind", "swift",
];
let start = cons.clone();
let end = vec![
"root", "bark", "log", "brook", "well", "shire", "leaf", "more", "bole", "heart", "song", "dew",
"bough", "path", "wind", "breeze", "light", "branch", "bloom", "vale", "glen", "rest", "shade",
"fall", "sward", "thicket", "shrub", "bush", "grasp", "grip", "gale", "crawl", "run", "shadow",
"root", "bark", "log", "brook", "well", "shire", "leaf", "more", "bole", "heart",
"song", "dew", "bough", "path", "wind", "breeze", "light", "branch", "bloom", "vale",
"glen", "rest", "shade", "fall", "sward", "thicket", "shrub", "bush", "grasp", "grip",
"gale", "crawl", "run", "shadow",
];
let mut name = String::new();
name += start.choose(self.rng).unwrap();