2019-05-09 00:13:15 +02:00
|
|
|
#[derive(Debug)]
|
2019-05-09 01:16:43 +02:00
|
|
|
pub enum Race {
|
2019-05-08 01:36:04 +02:00
|
|
|
Griffin,
|
|
|
|
Catte
|
|
|
|
}
|
|
|
|
impl Default for Race {
|
|
|
|
fn default() -> Self {
|
|
|
|
Race::Catte
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-09 00:13:15 +02:00
|
|
|
#[derive(Debug)]
|
2019-05-08 01:36:04 +02:00
|
|
|
struct ResearchItem {
|
|
|
|
levels: u8,
|
|
|
|
points: u16
|
|
|
|
}
|
|
|
|
impl Default for ResearchItem {
|
|
|
|
fn default() -> Self {
|
|
|
|
ResearchItem{
|
|
|
|
levels: 1,
|
|
|
|
points: 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-09 00:13:15 +02:00
|
|
|
#[derive(Default,Debug)]
|
2019-05-08 01:36:04 +02:00
|
|
|
struct Research {
|
|
|
|
weapons: ResearchItem,
|
|
|
|
banking: ResearchItem,
|
|
|
|
manufactoring: ResearchItem,
|
|
|
|
terraforming: ResearchItem,
|
|
|
|
hyperspace: ResearchItem,
|
|
|
|
experimentation: ResearchItem,
|
|
|
|
scanning: ResearchItem
|
|
|
|
}
|
|
|
|
|
2019-05-09 00:13:15 +02:00
|
|
|
#[derive(Debug)]
|
2019-05-08 01:36:04 +02:00
|
|
|
pub struct Player {
|
2019-05-09 01:16:43 +02:00
|
|
|
name: String,
|
2019-05-08 01:36:04 +02:00
|
|
|
color: (u8, u8, u8),
|
|
|
|
race: Race,
|
|
|
|
research: Research
|
|
|
|
}
|
|
|
|
impl Default for Player {
|
|
|
|
fn default() -> Self {
|
|
|
|
Player{
|
|
|
|
name: String::default(),
|
|
|
|
//Color: (rand::thread_rng().gen(), rand::thread_rng().gen(), rand::thread_rng().gen()),
|
|
|
|
color: (0,0,0),
|
|
|
|
race: Race::default(),
|
|
|
|
research: Research::default()
|
|
|
|
}
|
|
|
|
}
|
2019-05-09 01:16:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Player {
|
|
|
|
pub fn new(name: String, color: Option<(u8, u8, u8)>, race: Option<Race>) -> Player {
|
|
|
|
Player {
|
|
|
|
name: name,
|
|
|
|
color: color.unwrap_or(Player::default().color),
|
|
|
|
race: race.unwrap_or(Player::default().race),
|
|
|
|
research: Research::default()
|
|
|
|
}
|
|
|
|
}
|
2019-05-08 01:36:04 +02:00
|
|
|
}
|