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