--- 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