author | alfadur |
Mon, 09 Jul 2018 20:31:32 +0300 | |
changeset 13486 | 8697b235f236 |
parent 13483 | d79795acaa73 |
child 13511 | 36f3f77e9b1b |
child 13525 | 1ee192f13456 |
permissions | -rw-r--r-- |
13483 | 1 |
use server::coretypes::{ |
2 |
ServerVar, GameCfg, TeamInfo, |
|
3 |
HedgehogInfo, VoteType |
|
4 |
}; |
|
13444 | 5 |
use std::{ops, convert::From, iter::once}; |
12135 | 6 |
|
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
7 |
#[derive(PartialEq, Eq, Clone, Debug)] |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
8 |
pub enum HWProtocolMessage { |
12135 | 9 |
// core |
10 |
Ping, |
|
11 |
Pong, |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
12 |
Quit(Option<String>), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
13 |
//Cmd(String, Vec<String>), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
14 |
Global(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
15 |
Watch(String), |
12135 | 16 |
ToggleServerRegisteredOnly, |
17 |
SuperPower, |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
18 |
Info(String), |
12135 | 19 |
// not entered state |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
20 |
Nick(String), |
12135 | 21 |
Proto(u32), |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
22 |
Password(String, String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
23 |
Checker(u32, String, String), |
12135 | 24 |
// lobby |
25 |
List, |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
26 |
Chat(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
27 |
CreateRoom(String, Option<String>), |
13421 | 28 |
JoinRoom(String, Option<String>), |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
29 |
Follow(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
30 |
Rnd(Vec<String>), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
31 |
Kick(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
32 |
Ban(String, String, u32), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
33 |
BanIP(String, String, u32), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
34 |
BanNick(String, String, u32), |
12135 | 35 |
BanList, |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
36 |
Unban(String), |
12135 | 37 |
SetServerVar(ServerVar), |
38 |
GetServerVar, |
|
39 |
RestartServer, |
|
40 |
Stats, |
|
41 |
// in room |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
42 |
Part(Option<String>), |
12135 | 43 |
Cfg(GameCfg), |
44 |
AddTeam(TeamInfo), |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
45 |
RemoveTeam(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
46 |
SetHedgehogsNumber(String, u8), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
47 |
SetTeamColor(String, u8), |
12135 | 48 |
ToggleReady, |
49 |
StartGame, |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
50 |
EngineMessage(String), |
12135 | 51 |
RoundFinished, |
52 |
ToggleRestrictJoin, |
|
53 |
ToggleRestrictTeams, |
|
54 |
ToggleRegisteredOnly, |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
55 |
RoomName(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
56 |
Delegate(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
57 |
TeamChat(String), |
12135 | 58 |
MaxTeams(u8), |
59 |
Fix, |
|
60 |
Unfix, |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
61 |
Greeting(String), |
13483 | 62 |
CallVote(Option<VoteType>), |
63 |
Vote(bool), |
|
64 |
ForceVote(bool), |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
65 |
Save(String, String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
66 |
Delete(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
67 |
SaveRoom(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
68 |
LoadRoom(String), |
12142
193dfdcb0620
- Use logging facilities instead of plain println!
unc0rr
parents:
12141
diff
changeset
|
69 |
Malformed, |
193dfdcb0620
- Use logging facilities instead of plain println!
unc0rr
parents:
12141
diff
changeset
|
70 |
Empty, |
12135 | 71 |
} |
12136 | 72 |
|
13421 | 73 |
#[derive(Debug)] |
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
74 |
pub enum HWServerMessage { |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
75 |
Ping, |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
76 |
Pong, |
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
77 |
Bye(String), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
78 |
Nick(String), |
13421 | 79 |
Proto(u32), |
80 |
LobbyLeft(String, String), |
|
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
81 |
LobbyJoined(Vec<String>), |
13449
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13445
diff
changeset
|
82 |
ChatMsg {nick: String, msg: String}, |
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
83 |
ClientFlags(String, Vec<String>), |
13421 | 84 |
Rooms(Vec<String>), |
85 |
RoomAdd(Vec<String>), |
|
86 |
RoomJoined(Vec<String>), |
|
87 |
RoomLeft(String, String), |
|
88 |
RoomRemove(String), |
|
89 |
RoomUpdated(String, Vec<String>), |
|
13424 | 90 |
TeamAdd(Vec<String>), |
91 |
TeamRemove(String), |
|
92 |
TeamAccepted(String), |
|
93 |
TeamColor(String, u8), |
|
94 |
HedgehogsNumber(String, u8), |
|
13427 | 95 |
ConfigEntry(String, Vec<String>), |
13483 | 96 |
Kicked, |
13428 | 97 |
RunGame, |
13433 | 98 |
ForwardEngineMessage(Vec<String>), |
13428 | 99 |
RoundFinished, |
13424 | 100 |
|
13421 | 101 |
ServerMessage(String), |
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
102 |
Warning(String), |
13421 | 103 |
Error(String), |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
104 |
Connected(u32), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
105 |
Unreachable, |
12136 | 106 |
} |
12141 | 107 |
|
13483 | 108 |
pub fn server_chat(msg: &str) -> HWServerMessage { |
109 |
HWServerMessage::ChatMsg{ nick: "[server]".to_string(), msg: msg.to_string() } |
|
110 |
} |
|
111 |
||
13427 | 112 |
impl GameCfg { |
13444 | 113 |
pub fn to_protocol(&self) -> (String, Vec<String>) { |
13427 | 114 |
use server::coretypes::GameCfg::*; |
115 |
match self { |
|
13444 | 116 |
FeatureSize(s) => ("FEATURE_SIZE".to_string(), vec![s.to_string()]), |
117 |
MapType(t) => ("MAP".to_string(), vec![t.to_string()]), |
|
118 |
MapGenerator(g) => ("MAPGEN".to_string(), vec![g.to_string()]), |
|
119 |
MazeSize(s) => ("MAZE_SIZE".to_string(), vec![s.to_string()]), |
|
120 |
Seed(s) => ("SEED".to_string(), vec![s.to_string()]), |
|
121 |
Template(t) => ("TEMPLATE".to_string(), vec![t.to_string()]), |
|
13427 | 122 |
|
13444 | 123 |
Ammo(n, None) => ("AMMO".to_string(), vec![n.to_string()]), |
124 |
Ammo(n, Some(s)) => ("AMMO".to_string(), vec![n.to_string(), s.to_string()]), |
|
125 |
Scheme(n, None) => ("SCHEME".to_string(), vec![n.to_string()]), |
|
126 |
Scheme(n, Some(s)) => ("SCHEME".to_string(), { |
|
13427 | 127 |
let mut v = vec![n.to_string()]; |
13444 | 128 |
v.extend(s.clone().into_iter()); |
13427 | 129 |
v |
130 |
}), |
|
13444 | 131 |
Script(s) => ("SCRIPT".to_string(), vec![s.to_string()]), |
132 |
Theme(t) => ("THEME".to_string(), vec![t.to_string()]), |
|
133 |
DrawnMap(m) => ("DRAWNMAP".to_string(), vec![m.to_string()]) |
|
13427 | 134 |
} |
135 |
} |
|
13444 | 136 |
|
137 |
pub fn to_server_msg(&self) -> HWServerMessage { |
|
138 |
use self::HWServerMessage::ConfigEntry; |
|
139 |
let (name, args) = self.to_protocol(); |
|
140 |
HWServerMessage::ConfigEntry(name, args) |
|
141 |
} |
|
13427 | 142 |
} |
143 |
||
13421 | 144 |
macro_rules! const_braces { |
145 |
($e: expr) => { "{}\n" } |
|
146 |
} |
|
147 |
||
148 |
macro_rules! msg { |
|
149 |
[$($part: expr),*] => { |
|
150 |
format!(concat!($(const_braces!($part)),*, "\n"), $($part),*); |
|
151 |
}; |
|
152 |
} |
|
153 |
||
13444 | 154 |
macro_rules! several { |
155 |
[$part: expr] => { once($part) }; |
|
156 |
[$part: expr, $($other: expr),*] => { once($part).chain(several![$($other),*]) }; |
|
157 |
} |
|
158 |
||
13438
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
159 |
impl HWProtocolMessage { |
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
160 |
/** Converts the message to a raw `String`, which can be sent over the network. |
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
161 |
* |
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
162 |
* This is the inverse of the `message` parser. |
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
163 |
*/ |
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
164 |
pub(crate) fn to_raw_protocol(&self) -> String { |
13437 | 165 |
use self::HWProtocolMessage::*; |
166 |
match self { |
|
167 |
Ping => msg!["PING"], |
|
168 |
Pong => msg!["PONG"], |
|
169 |
Quit(None) => msg!["QUIT"], |
|
170 |
Quit(Some(msg)) => msg!["QUIT", msg], |
|
171 |
Global(msg) => msg!["CMD", format!("GLOBAL {}", msg)], |
|
172 |
Watch(name) => msg!["CMD", format!("WATCH {}", name)], |
|
173 |
ToggleServerRegisteredOnly => msg!["CMD", "REGISTERED_ONLY"], |
|
174 |
SuperPower => msg!["CMD", "SUPER_POWER"], |
|
175 |
Info(info) => msg!["CMD", format!("INFO {}", info)], |
|
176 |
Nick(nick) => msg!("NICK", nick), |
|
177 |
Proto(version) => msg!["PROTO", version], |
|
178 |
Password(p, s) => msg!["PASSWORD", p, s], |
|
179 |
Checker(i, n, p) => msg!["CHECKER", i, n, p], |
|
180 |
List => msg!["LIST"], |
|
181 |
Chat(msg) => msg!["CHAT", msg], |
|
182 |
CreateRoom(name, None) => msg!["CREATE_ROOM", name], |
|
183 |
CreateRoom(name, Some(password)) => |
|
184 |
msg!["CREATE_ROOM", name, password], |
|
185 |
JoinRoom(name, None) => msg!["JOIN_ROOM", name], |
|
186 |
JoinRoom(name, Some(password)) => |
|
187 |
msg!["JOIN_ROOM", name, password], |
|
188 |
Follow(name) => msg!["FOLLOW", name], |
|
13438
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
189 |
Rnd(args) => if args.is_empty() { |
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
190 |
msg!["CMD", "RND"] |
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
191 |
} else { |
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
192 |
msg!["CMD", format!("RND {}", args.join(" "))] |
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
193 |
}, |
13437 | 194 |
Kick(name) => msg!["KICK", name], |
195 |
Ban(name, reason, time) => msg!["BAN", name, reason, time], |
|
196 |
BanIP(ip, reason, time) => msg!["BAN_IP", ip, reason, time], |
|
197 |
BanNick(nick, reason, time) => |
|
198 |
msg!("BAN_NICK", nick, reason, time), |
|
199 |
BanList => msg!["BANLIST"], |
|
200 |
Unban(name) => msg!["UNBAN", name], |
|
201 |
//SetServerVar(ServerVar), ??? |
|
202 |
GetServerVar => msg!["GET_SERVER_VAR"], |
|
203 |
RestartServer => msg!["CMD", "RESTART_SERVER YES"], |
|
204 |
Stats => msg!["CMD", "STATS"], |
|
205 |
Part(None) => msg!["PART"], |
|
206 |
Part(Some(msg)) => msg!["PART", msg], |
|
13444 | 207 |
Cfg(config) => { |
208 |
let (name, args) = config.to_protocol(); |
|
209 |
msg!["CFG", name, args.join("\n")] |
|
210 |
}, |
|
211 |
AddTeam(info) => |
|
13445 | 212 |
msg!["ADD_TEAM", info.name, info.color, info.grave, info.fort, |
13444 | 213 |
info.voice_pack, info.flag, info.difficulty, |
13445 | 214 |
info.hedgehogs.iter() |
215 |
.flat_map(|h| several![&h.name[..], &h.hat[..]]) |
|
216 |
.collect::<Vec<_>>().join("\n")], |
|
13437 | 217 |
RemoveTeam(name) => msg!["REMOVE_TEAM", name], |
13444 | 218 |
SetHedgehogsNumber(team, number) => msg!["HH_NUM", team, number], |
219 |
SetTeamColor(team, color) => msg!["TEAM_COLOR", team, color], |
|
13437 | 220 |
ToggleReady => msg!["TOGGLE_READY"], |
221 |
StartGame => msg!["START_GAME"], |
|
222 |
EngineMessage(msg) => msg!["EM", msg], |
|
223 |
RoundFinished => msg!["ROUNDFINISHED"], |
|
224 |
ToggleRestrictJoin => msg!["TOGGLE_RESTRICT_JOINS"], |
|
225 |
ToggleRestrictTeams => msg!["TOGGLE_RESTRICT_TEAMS"], |
|
226 |
ToggleRegisteredOnly => msg!["TOGGLE_REGISTERED_ONLY"], |
|
227 |
RoomName(name) => msg!["ROOM_NAME", name], |
|
228 |
Delegate(name) => msg!["CMD", format!("DELEGATE {}", name)], |
|
229 |
TeamChat(msg) => msg!["TEAMCHAT", msg], |
|
230 |
MaxTeams(count) => msg!["CMD", format!("MAXTEAMS {}", count)] , |
|
231 |
Fix => msg!["CMD", "FIX"], |
|
232 |
Unfix => msg!["CMD", "UNFIX"], |
|
233 |
Greeting(msg) => msg!["CMD", format!("GREETING {}", msg)], |
|
234 |
//CallVote(Option<(String, Option<String>)>) =>, ?? |
|
13486 | 235 |
Vote(msg) => msg!["CMD", format!("VOTE {}", if *msg {"YES"} else {"NO"})], |
236 |
ForceVote(msg) => msg!["CMD", format!("FORCE {}", if *msg {"YES"} else {"NO"})], |
|
13437 | 237 |
//Save(String, String), ?? |
238 |
Delete(room) => msg!["CMD", format!("DELETE {}", room)], |
|
239 |
SaveRoom(room) => msg!["CMD", format!("SAVEROOM {}", room)], |
|
240 |
LoadRoom(room) => msg!["CMD", format!("LOADROOM {}", room)], |
|
241 |
Malformed => msg!["A", "QUICK", "BROWN", "HOG", "JUMPS", "OVER", "THE", "LAZY", "DOG"], |
|
242 |
Empty => msg![""], |
|
243 |
_ => panic!("Protocol message not yet implemented") |
|
244 |
} |
|
245 |
} |
|
246 |
} |
|
247 |
||
13424 | 248 |
fn construct_message(header: &[&str], msg: &Vec<String>) -> String { |
249 |
let mut v: Vec<_> = header.iter().map(|s| *s).collect(); |
|
250 |
v.extend(msg.iter().map(|s| &s[..])); |
|
251 |
v.push("\n"); |
|
252 |
v.join("\n") |
|
13421 | 253 |
} |
254 |
||
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
255 |
impl HWServerMessage { |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
256 |
pub fn to_raw_protocol(&self) -> String { |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
257 |
use self::HWServerMessage::*; |
12141 | 258 |
match self { |
13421 | 259 |
Ping => msg!["PING"], |
260 |
Pong => msg!["PONG"], |
|
261 |
Connected(protocol_version) => msg![ |
|
262 |
"CONNECTED", |
|
263 |
"Hedgewars server http://www.hedgewars.org/", |
|
264 |
protocol_version], |
|
265 |
Bye(msg) => msg!["BYE", msg], |
|
266 |
Nick(nick) => msg!["NICK", nick], |
|
267 |
Proto(proto) => msg!["PROTO", proto], |
|
268 |
LobbyLeft(nick, msg) => msg!["LOBBY:LEFT", nick, msg], |
|
13424 | 269 |
LobbyJoined(nicks) => |
270 |
construct_message(&["LOBBY:JOINED"], &nicks), |
|
271 |
ClientFlags(flags, nicks) => |
|
272 |
construct_message(&["CLIENT_FLAGS", flags], &nicks), |
|
273 |
Rooms(info) => |
|
274 |
construct_message(&["ROOMS"], &info), |
|
275 |
RoomAdd(info) => |
|
276 |
construct_message(&["ROOM", "ADD"], &info), |
|
277 |
RoomJoined(nicks) => |
|
278 |
construct_message(&["JOINED"], &nicks), |
|
13421 | 279 |
RoomLeft(nick, msg) => msg!["LEFT", nick, msg], |
280 |
RoomRemove(name) => msg!["ROOM", "DEL", name], |
|
13424 | 281 |
RoomUpdated(name, info) => |
282 |
construct_message(&["ROOM", "UPD", name], &info), |
|
283 |
TeamAdd(info) => |
|
284 |
construct_message(&["ADD_TEAM"], &info), |
|
285 |
TeamRemove(name) => msg!["REMOVE_TEAM", name], |
|
286 |
TeamAccepted(name) => msg!["TEAM_ACCEPTED", name], |
|
287 |
TeamColor(name, color) => msg!["TEAM_COLOR", name, color], |
|
288 |
HedgehogsNumber(name, number) => msg!["HH_NUM", name, number], |
|
13427 | 289 |
ConfigEntry(name, values) => |
290 |
construct_message(&["CFG", name], &values), |
|
13483 | 291 |
Kicked => msg!["KICKED"], |
13428 | 292 |
RunGame => msg!["RUN_GAME"], |
13433 | 293 |
ForwardEngineMessage(em) => |
294 |
construct_message(&["EM"], &em), |
|
13428 | 295 |
RoundFinished => msg!["ROUND_FINISHED"], |
13449
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13445
diff
changeset
|
296 |
ChatMsg {nick, msg} => msg!["CHAT", nick, msg], |
13421 | 297 |
ServerMessage(msg) => msg!["SERVER_MESSAGE", msg], |
298 |
Warning(msg) => msg!["WARNING", msg], |
|
299 |
Error(msg) => msg!["ERROR", msg], |
|
300 |
_ => msg!["ERROR", "UNIMPLEMENTED"], |
|
12141 | 301 |
} |
302 |
} |
|
303 |
} |