12130
|
1 |
use server::coretypes::{ServerVar, GameCfg, TeamInfo, HedgehogInfo};
|
12131
|
2 |
use std;
|
|
3 |
use std::ops;
|
|
4 |
use std::convert::From;
|
12130
|
5 |
|
12131
|
6 |
#[derive(PartialEq, Debug)]
|
|
7 |
pub enum HWProtocolMessage {
|
12130
|
8 |
// core
|
|
9 |
Ping,
|
|
10 |
Pong,
|
12131
|
11 |
Quit(Option<String>),
|
|
12 |
//Cmd(String, Vec<String>),
|
|
13 |
Global(String),
|
|
14 |
Watch(String),
|
12130
|
15 |
ToggleServerRegisteredOnly,
|
|
16 |
SuperPower,
|
12131
|
17 |
Info(String),
|
12130
|
18 |
// not entered state
|
12131
|
19 |
Nick(String),
|
12130
|
20 |
Proto(u32),
|
12131
|
21 |
Password(String, String),
|
|
22 |
Checker(String),
|
12130
|
23 |
// lobby
|
|
24 |
List,
|
12131
|
25 |
Chat(String),
|
|
26 |
CreateRoom(String, Option<String>),
|
|
27 |
Join(String, Option<String>),
|
|
28 |
Follow(String),
|
|
29 |
Rnd(Vec<String>),
|
|
30 |
Kick(String),
|
|
31 |
Ban(String, String, u32),
|
|
32 |
BanIP(String, String, u32),
|
|
33 |
BanNick(String, String, u32),
|
12130
|
34 |
BanList,
|
12131
|
35 |
Unban(String),
|
12130
|
36 |
SetServerVar(ServerVar),
|
|
37 |
GetServerVar,
|
|
38 |
RestartServer,
|
|
39 |
Stats,
|
|
40 |
// in room
|
12131
|
41 |
Part(Option<String>),
|
12130
|
42 |
Cfg(GameCfg),
|
|
43 |
AddTeam(TeamInfo),
|
12131
|
44 |
RemoveTeam(String),
|
|
45 |
SetHedgehogsNumber(String, u8),
|
|
46 |
SetTeamColor(String, u8),
|
12130
|
47 |
ToggleReady,
|
|
48 |
StartGame,
|
|
49 |
EngineMessage,
|
|
50 |
RoundFinished,
|
|
51 |
ToggleRestrictJoin,
|
|
52 |
ToggleRestrictTeams,
|
|
53 |
ToggleRegisteredOnly,
|
12131
|
54 |
RoomName(String),
|
|
55 |
Delegate(String),
|
|
56 |
TeamChat(String),
|
12130
|
57 |
MaxTeams(u8),
|
|
58 |
Fix,
|
|
59 |
Unfix,
|
12131
|
60 |
Greeting(String),
|
|
61 |
CallVote(Option<(String, Option<String>)>),
|
|
62 |
Vote(String),
|
|
63 |
ForceVote(String),
|
|
64 |
Save(String, String),
|
|
65 |
Delete(String, String),
|
|
66 |
SaveRoom(String),
|
|
67 |
LoadRoom(String),
|
12130
|
68 |
}
|
12131
|
69 |
|
|
70 |
pub fn number<T: From<u8>
|
|
71 |
+ std::default::Default
|
|
72 |
+ std::ops::MulAssign
|
|
73 |
+ std::ops::AddAssign>
|
|
74 |
(digits: Vec<u8>) -> T {
|
|
75 |
let mut value: T = T::default();
|
|
76 |
for digit in digits {
|
|
77 |
value *= T::from(10);
|
|
78 |
value += T::from(digit);
|
|
79 |
}
|
|
80 |
value
|
|
81 |
}
|