add Default trait to player object
This commit is contained in:
parent
b1f081dc86
commit
f813c1681e
21
Player.rs
21
Player.rs
|
@ -2,14 +2,28 @@ enum Race {
|
|||
Griffin,
|
||||
Catte
|
||||
}
|
||||
impl Default for Race {
|
||||
fn default() -> Self {
|
||||
Race::Catte
|
||||
}
|
||||
}
|
||||
|
||||
struct ResearchItem {
|
||||
levels: u8,
|
||||
points: u16
|
||||
}
|
||||
impl Default for ResearchItem {
|
||||
fn default() -> Self {
|
||||
ResearchItem{
|
||||
levels: 1,
|
||||
points: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct Research {
|
||||
Weapons: ResearchItem
|
||||
Weapons: ResearchItem,
|
||||
Banking: ResearchItem,
|
||||
Manufactoring: ResearchItem,
|
||||
Terraforming: ResearchItem,
|
||||
|
@ -18,9 +32,10 @@ struct Research {
|
|||
Scanning: ResearchItem
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct Player {
|
||||
Name: String,
|
||||
Color: (u8, u8, u8),
|
||||
Race: Race,
|
||||
Research
|
||||
}
|
||||
Research: Research
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue