gameServer2/src/server/coretypes.rs
changeset 13478 d79795acaa73
parent 13422 5fb27f94fc3b
child 13795 e335daaa77a9
--- a/gameServer2/src/server/coretypes.rs	Fri Jul 06 21:03:03 2018 +0300
+++ b/gameServer2/src/server/coretypes.rs	Sat Jul 07 20:22:31 2018 +0300
@@ -1,3 +1,6 @@
+pub type ClientId = usize;
+pub type RoomId = usize;
+
 #[derive(PartialEq, Eq, Clone, Debug)]
 pub enum ServerVar {
     MOTDNew(String),
@@ -39,3 +42,29 @@
     pub name: String,
     pub hat: String,
 }
+
+#[derive(PartialEq, Eq, Clone, Debug)]
+pub enum VoteType {
+    Kick(String),
+    Map(Option<String>),
+    Pause,
+    NewSeed,
+    HedgehogsPerTeam(u8)
+}
+
+#[derive(Clone, Debug)]
+pub struct Voting {
+    pub ttl: u32,
+    pub voters: Vec<ClientId>,
+    pub votes: Vec<(ClientId, bool)>,
+    pub kind: VoteType
+}
+
+impl Voting {
+    pub fn new(kind: VoteType, voters: Vec<ClientId>) -> Voting {
+        Voting {
+            kind, voters, ttl: 2,
+            votes: Vec::new()
+        }
+    }
+}
\ No newline at end of file