From 4a8c428a3fe41b81a9a718356e3ca86a99965a6d Mon Sep 17 00:00:00 2001 From: floppy Date: Tue, 18 Jan 2022 08:36:40 +0100 Subject: [PATCH] update/add namegen-bricks for forest and grassland --- world/src/civ/mod.rs | 46 ++++++++++++++++++--------------------- world/src/site/namegen.rs | 34 ++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 28 deletions(-) diff --git a/world/src/civ/mod.rs b/world/src/civ/mod.rs index 870b880534..5355027896 100644 --- a/world/src/civ/mod.rs +++ b/world/src/civ/mod.rs @@ -527,79 +527,79 @@ impl Civs { match ctx.rng.gen_range(0..8) { 0 => format!( "{}\nForest", - NameGen::location(&mut ctx.rng).generate_forest() + NameGen::location(&mut ctx.rng).generate_temp_forest() ), 1 => format!( "{}\nWoodlands", - NameGen::location(&mut ctx.rng).generate_forest() + NameGen::location(&mut ctx.rng).generate_temp_forest() ), 2 => format!( "{}\nWoods", - NameGen::location(&mut ctx.rng).generate_forest() + NameGen::location(&mut ctx.rng).generate_temp_forest() ), 3 => format!( "{}\nGlades", - NameGen::location(&mut ctx.rng).generate_forest() + NameGen::location(&mut ctx.rng).generate_temp_forest() ), 4 => format!( "{}\nGrove", - NameGen::location(&mut ctx.rng).generate_forest() + NameGen::location(&mut ctx.rng).generate_temp_forest() ), 5 => format!( "{}\nGlades", - NameGen::location(&mut ctx.rng).generate_forest() + NameGen::location(&mut ctx.rng).generate_temp_forest() ), 6 => format!( "{}\nThickets", - NameGen::location(&mut ctx.rng).generate_forest() + NameGen::location(&mut ctx.rng).generate_temp_forest() ), 7 => format!( "{}\nWeald", - NameGen::location(&mut ctx.rng).generate_forest() + NameGen::location(&mut ctx.rng).generate_temp_forest() ), _ => format!( "{}\nForest", - NameGen::location(&mut ctx.rng).generate_forest() + NameGen::location(&mut ctx.rng).generate_temp_forest() ), } }, common::terrain::BiomeKind::Grassland if biome.1.len() as u32 > 750 => { - match ctx.rng.gen_range(0..11) { + match ctx.rng.gen_range(0..10) { 0 => format!( "{}\nGrasslands", - NameGen::location(&mut ctx.rng).generate_biome() + NameGen::location(&mut ctx.rng).generate_grassland() ), 1 => format!( "{}\nFlats", - NameGen::location(&mut ctx.rng).generate_biome() + NameGen::location(&mut ctx.rng).generate_grassland() ), 2 => format!( "{}\nGreens", - NameGen::location(&mut ctx.rng).generate_biome() + NameGen::location(&mut ctx.rng).generate_grassland() ), 3 => format!( "{}\nPlains", - NameGen::location(&mut ctx.rng).generate_biome() + NameGen::location(&mut ctx.rng).generate_grassland() ), 4 => format!( "{}\nMeadows", - NameGen::location(&mut ctx.rng).generate_biome() + NameGen::location(&mut ctx.rng).generate_grassland() ), 5 => format!( "{}\nFields", - NameGen::location(&mut ctx.rng).generate_biome() + NameGen::location(&mut ctx.rng).generate_grassland() ), 6 => format!( "{}\nHeath", - NameGen::location(&mut ctx.rng).generate_biome() + NameGen::location(&mut ctx.rng).generate_grassland() ), 7 => format!( "{}\nPrairie", - NameGen::location(&mut ctx.rng).generate_biome() + NameGen::location(&mut ctx.rng).generate_grassland() ), 8 => format!( "{}\nSteppe", - NameGen::location(&mut ctx.rng).generate_biome() + NameGen::location(&mut ctx.rng).generate_grassland() ), 9 => format!( "{}\nDowns", @@ -607,15 +607,11 @@ impl Civs { ), 10 => format!( "{}\nHeath", - NameGen::location(&mut ctx.rng).generate_biome() - ), - 11 => format!( - "{}\nHeath", - NameGen::location(&mut ctx.rng).generate_biome() + NameGen::location(&mut ctx.rng).generate_grassland() ), _ => format!( "{}\nGrassland", - NameGen::location(&mut ctx.rng).generate_biome() + NameGen::location(&mut ctx.rng).generate_grassland() ), } }, diff --git a/world/src/site/namegen.rs b/world/src/site/namegen.rs index 4192081870..aea001bafe 100644 --- a/world/src/site/namegen.rs +++ b/world/src/site/namegen.rs @@ -91,19 +91,47 @@ impl<'a, R: Rng> NameGen<'a, R> { .collect() } - pub fn generate_forest(self) -> String { + pub fn generate_temp_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", + "fern", "quiet", "still", "gleam", "wild", "blind", "swift", "gnarl", "flutter", + "silent", "honey", "bramble", "rose", ]; 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", + "gale", "crawl", "run", "shadow", "rise", "glow", "wish", "will", "walk", "wander", + "wake", "eye", "blossom", "sprout", "barb", + ]; + let mut name = String::new(); + name += start.choose(self.rng).unwrap(); + name += end.choose(self.rng).unwrap(); + + name.chars() + .enumerate() + .map(|(i, c)| if i == 0 { c.to_ascii_uppercase() } else { c }) + .collect() + } + + pub fn generate_grassland(self) -> String { + let cons = vec![ + "green", "heather", "flower", "blue", "yellow", "vast", "moon", "star", "sun", + "bright", "fair", "calm", "mistral", "whisper", "clover", "sooth", "spring", "morrow", + "dim", "dusk", "dawn", "night", "shimmer", "silver", "gold", "amber", "quiet", "still", + "gleam", "wild", "corm", "mint", "feather", "silent", "bronze", "bister", "thistle", + "bristle", "dew", "bramble", "sorrel", "broad", "petal", + ]; + let start = cons.clone(); + let end = vec![ + "brook", "well", "flight", "more", "heart", "song", "barb", "wort", "hoof", "foot", + "herd", "path", "wind", "breeze", "light", "bloom", "rest", "balm", "reach", "flow", + "graze", "trail", "fall", "thicket", "shrub", "bush", "gale", "run", "stem", "glare", + "gaze", "rove", "brew", "rise", "glow", "wish", "will", "walk", "wander", "wake", + "sky", "burrow", "cross", "roam", ]; let mut name = String::new(); name += start.choose(self.rng).unwrap();