mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
tweak fn generate_biome in namegen
This commit is contained in:
parent
609d23ae4f
commit
88a39476bc
@ -3,6 +3,8 @@ use rand::prelude::*;
|
||||
pub struct NameGen<'a, R: Rng> {
|
||||
// 2..
|
||||
pub approx_syllables: usize,
|
||||
pub approx_syllables_long: usize,
|
||||
|
||||
rng: &'a mut R,
|
||||
}
|
||||
|
||||
@ -10,6 +12,8 @@ impl<'a, R: Rng> NameGen<'a, R> {
|
||||
pub fn location(rng: &'a mut R) -> Self {
|
||||
Self {
|
||||
approx_syllables: rng.gen_range(1..4),
|
||||
approx_syllables_long: rng.gen_range(2..4),
|
||||
|
||||
rng,
|
||||
}
|
||||
}
|
||||
@ -75,7 +79,7 @@ impl<'a, R: Rng> NameGen<'a, R> {
|
||||
let mut name = String::new();
|
||||
|
||||
name += start.choose(self.rng).unwrap();
|
||||
for _ in 0..self.approx_syllables.saturating_sub(2) + 1 {
|
||||
for _ in 0..self.approx_syllables_long.saturating_sub(2) {
|
||||
name += vowel.choose(self.rng).unwrap();
|
||||
name += middle.choose(self.rng).unwrap();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user