more words

This commit is contained in:
Niko Abeler 2022-12-31 09:51:38 +01:00
parent b25e620cc3
commit 979428b4fd
4 changed files with 39 additions and 22 deletions

View File

@ -5,12 +5,11 @@ pub struct TownNameGenerator {
impl TownNameGenerator {
pub fn name() -> String {
let first = include_str!("names/towns/first.txt").split("\n").collect::<Vec<&str>>();
let second = include_str!("names/towns/second.txt").split("\n").collect::<Vec<&str>>();
let words = include_str!("names/towns/first.txt").split("\n").collect::<Vec<&str>>();
let mut rng = rand::thread_rng();
let first = first.choose(&mut rng).unwrap();
let second = second.choose(&mut rng).unwrap();
let first = words.choose(&mut rng).unwrap();
let second = words.choose(&mut rng).unwrap();
let name = format!("{}{}", first, second);
// capitalize first letter
@ -23,13 +22,12 @@ pub struct PersonNameGenerator {
impl PersonNameGenerator {
pub fn name() -> String {
let first = include_str!("names/towns/first.txt").split("\n").collect::<Vec<&str>>();
let second = include_str!("names/towns/second.txt").split("\n").collect::<Vec<&str>>();
let words = include_str!("names/towns/first.txt").split("\n").collect::<Vec<&str>>();
let syllables = include_str!("names/people/syllables.txt").split("\n").collect::<Vec<&str>>();
let mut rng = rand::thread_rng();
let first = first.choose(&mut rng).unwrap();
let second = second.choose(&mut rng).unwrap();
let first = words.choose(&mut rng).unwrap();
let second = words.choose(&mut rng).unwrap();
let mut name = "".to_owned();
for _ in 0..rng.gen_range(2..5) {

View File

@ -5,8 +5,37 @@ gold
wood
frost
summer
autumn
winter
spring
dagger
sword
hammer
hammer
mace
shield
helm
plate
chain
mail
boot
gauntlet
tree
bush
grass
chalk
eagle
deer
air
fire
leather
death
life
rock
stone
pebble
twig
branch
leave
apple
pear
cherry

View File

@ -1,12 +0,0 @@
iron
copper
silver
gold
wood
frost
summer
winter
spring
dagger
sword
hammer

View File

@ -9,6 +9,7 @@ use crate::events::{FoundTown, WorldGenesis, PersonGenesis};
pub struct GameState {
pub time: Time,
pub world: World,
pub people: Vec<Rc<Person>>,
pub events: Vec<Box<Event>>
}
@ -39,6 +40,7 @@ impl GameState {
GameState {
time: Time { time: 0 },
people: Vec::new(),
world: world,
events: events,
}
@ -105,6 +107,6 @@ impl GameState {
}
pub fn add_person(&mut self, person: Rc<Person>) {
self.people.push(person);
}
}