more types
This commit is contained in:
parent
f813c1681e
commit
164cf5886d
41
Player.rs
41
Player.rs
|
@ -1,41 +0,0 @@
|
|||
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,
|
||||
Banking: ResearchItem,
|
||||
Manufactoring: ResearchItem,
|
||||
Terraforming: ResearchItem,
|
||||
Hyperspace: ResearchItem,
|
||||
Experimentation: ResearchItem,
|
||||
Scanning: ResearchItem
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct Player {
|
||||
Name: String,
|
||||
Color: (u8, u8, u8),
|
||||
Race: Race,
|
||||
Research: Research
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
enum Order {
|
||||
NOTHING
|
||||
}
|
||||
|
||||
pub struct Carrier {
|
||||
OwnerID: u8,
|
||||
name: String,
|
||||
ships: u16,
|
||||
location: (u16, u16),
|
||||
orders: Vec<Order>
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
mod player;
|
||||
mod star;
|
||||
mod carrier;
|
||||
|
||||
use game::player::Player;
|
||||
use game::star::Star;
|
||||
use game::carrier::Carrier;
|
||||
|
||||
struct Game {
|
||||
players: Vec<Player>,
|
||||
stars: Vec<Star>,
|
||||
carriers: Vec<Carrier>
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
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,
|
||||
banking: ResearchItem,
|
||||
manufactoring: ResearchItem,
|
||||
terraforming: ResearchItem,
|
||||
hyperspace: ResearchItem,
|
||||
experimentation: ResearchItem,
|
||||
scanning: ResearchItem
|
||||
}
|
||||
|
||||
//#[derive(Default)]
|
||||
pub struct Player {
|
||||
name: String,
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
struct Infrastructre {
|
||||
factory: u16,
|
||||
lab: u16,
|
||||
bank: u16
|
||||
}
|
||||
|
||||
pub struct Star {
|
||||
ownerID: Option<u8>,
|
||||
location: (u16, u16),
|
||||
name: String,
|
||||
natural_resources: u16,
|
||||
infrastructre: Infrastructre,
|
||||
hypergate: bool,
|
||||
ships: u16
|
||||
}
|
Loading…
Reference in New Issue