From d7baa63e640b50d2a0a70801969e0aa589927452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B8vbr=C3=B8tte=20Olsen?= Date: Wed, 23 Jan 2019 21:04:52 +0100 Subject: [PATCH] Add some types --- Carrier.rs | 20 ++++++++++++++++++++ Player.rs | 25 +++++++++++++++++++++++++ Stars.rs | 13 +++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 Carrier.rs create mode 100644 Player.rs create mode 100644 Stars.rs diff --git a/Carrier.rs b/Carrier.rs new file mode 100644 index 0000000..5b83c72 --- /dev/null +++ b/Carrier.rs @@ -0,0 +1,20 @@ +use std::collections::VecDeque; + +enum Action { + NOTHING, + GARRISON(u16), + DROP_ALL, + DROP(u16), + DROP_ALL_BUT(u16), + COLLECT_ALL, + COLLECT(u16), + COLLECT_ALL_BUT(u16), + LOOP +} + +struct Carrier { + ships: u16, + action_queue: VecDeque<(&star, Action)>, + past_actions: VecDeque<(&star, Action)>, + owner: &player +} \ No newline at end of file diff --git a/Player.rs b/Player.rs new file mode 100644 index 0000000..a1e6083 --- /dev/null +++ b/Player.rs @@ -0,0 +1,25 @@ +enum Race { + Griffin, +} + +struct Research { + Weapons: u8, + Banking: u8, + Manufactoring: u8, + Terraforming: u8, + Hyperspace: u8, + Experimentation: u8, + Scanning: u8 +} + +impl Research { + fn getWeaponsLevel() { + this.Weapons. + } +} + +struct Player { + Name: String, + Color: (u8, u8, u8), + Race: Race, +} \ No newline at end of file diff --git a/Stars.rs b/Stars.rs new file mode 100644 index 0000000..626fa6f --- /dev/null +++ b/Stars.rs @@ -0,0 +1,13 @@ +struct Star { + resources: u16, + name: String, + ships: u16, + owner: &Player, + infrastructure: Infrastructure +} + +struct Infrastructure { + Fabrication: u8, + Science: u8, + Finance: u8 +} \ No newline at end of file