author | Wuzzy <Wuzzy2@mail.ru> |
Thu, 02 Aug 2018 04:40:42 +0200 | |
changeset 13605 | 75c322ac6670 |
parent 13483 | d79795acaa73 |
child 13800 | e335daaa77a9 |
permissions | -rw-r--r-- |
13483 | 1 |
pub type ClientId = usize; |
2 |
pub type RoomId = usize; |
|
3 |
||
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12136
diff
changeset
|
4 |
#[derive(PartialEq, Eq, Clone, Debug)] |
12135 | 5 |
pub enum ServerVar { |
6 |
MOTDNew(String), |
|
7 |
MOTDOld(String), |
|
8 |
LatestProto(u32), |
|
9 |
} |
|
10 |
||
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12136
diff
changeset
|
11 |
#[derive(PartialEq, Eq, Clone, Debug)] |
12135 | 12 |
pub enum GameCfg { |
13427 | 13 |
FeatureSize(u32), |
14 |
MapType(String), |
|
15 |
MapGenerator(u32), |
|
16 |
MazeSize(u32), |
|
17 |
Seed(String), |
|
18 |
Template(u32), |
|
12135 | 19 |
|
13427 | 20 |
Ammo(String, Option<String>), |
21 |
Scheme(String, Option<Vec<String>>), |
|
22 |
Script(String), |
|
23 |
Theme(String), |
|
24 |
DrawnMap(String) |
|
12135 | 25 |
} |
26 |
||
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12136
diff
changeset
|
27 |
#[derive(PartialEq, Eq, Clone, Debug)] |
12135 | 28 |
pub struct TeamInfo { |
13424 | 29 |
pub name: String, |
30 |
pub color: u8, |
|
31 |
pub grave: String, |
|
32 |
pub fort: String, |
|
33 |
pub voice_pack: String, |
|
34 |
pub flag: String, |
|
35 |
pub difficulty: u8, |
|
36 |
pub hedgehogs_number: u8, |
|
37 |
pub hedgehogs: [HedgehogInfo; 8], |
|
12135 | 38 |
} |
39 |
||
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12136
diff
changeset
|
40 |
#[derive(PartialEq, Eq, Clone, Debug)] |
12135 | 41 |
pub struct HedgehogInfo { |
13424 | 42 |
pub name: String, |
43 |
pub hat: String, |
|
12135 | 44 |
} |
13483 | 45 |
|
46 |
#[derive(PartialEq, Eq, Clone, Debug)] |
|
47 |
pub enum VoteType { |
|
48 |
Kick(String), |
|
49 |
Map(Option<String>), |
|
50 |
Pause, |
|
51 |
NewSeed, |
|
52 |
HedgehogsPerTeam(u8) |
|
53 |
} |
|
54 |
||
55 |
#[derive(Clone, Debug)] |
|
56 |
pub struct Voting { |
|
57 |
pub ttl: u32, |
|
58 |
pub voters: Vec<ClientId>, |
|
59 |
pub votes: Vec<(ClientId, bool)>, |
|
60 |
pub kind: VoteType |
|
61 |
} |
|
62 |
||
63 |
impl Voting { |
|
64 |
pub fn new(kind: VoteType, voters: Vec<ClientId>) -> Voting { |
|
65 |
Voting { |
|
66 |
kind, voters, ttl: 2, |
|
67 |
votes: Vec::new() |
|
68 |
} |
|
69 |
} |
|
70 |
} |