author | alfadur |
Fri, 07 Sep 2018 04:16:05 +0300 | |
changeset 13805 | 0118b7412570 |
parent 13803 | 4664da990556 |
child 13806 | 5fb40c8e5542 |
permissions | -rw-r--r-- |
13671 | 1 |
use crate::server::coretypes::{ |
13483 | 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), |
13525 | 21 |
Proto(u16), |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
22 |
Password(String, String), |
13803 | 23 |
Checker(u16, 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), |
13529 | 44 |
AddTeam(Box<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), |
13525 | 79 |
Proto(u16), |
13805 | 80 |
ServerAuth(String), |
13421 | 81 |
LobbyLeft(String, String), |
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
82 |
LobbyJoined(Vec<String>), |
13449
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13445
diff
changeset
|
83 |
ChatMsg {nick: String, msg: String}, |
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
84 |
ClientFlags(String, Vec<String>), |
13421 | 85 |
Rooms(Vec<String>), |
86 |
RoomAdd(Vec<String>), |
|
87 |
RoomJoined(Vec<String>), |
|
88 |
RoomLeft(String, String), |
|
89 |
RoomRemove(String), |
|
90 |
RoomUpdated(String, Vec<String>), |
|
13424 | 91 |
TeamAdd(Vec<String>), |
92 |
TeamRemove(String), |
|
93 |
TeamAccepted(String), |
|
94 |
TeamColor(String, u8), |
|
95 |
HedgehogsNumber(String, u8), |
|
13427 | 96 |
ConfigEntry(String, Vec<String>), |
13483 | 97 |
Kicked, |
13428 | 98 |
RunGame, |
13433 | 99 |
ForwardEngineMessage(Vec<String>), |
13428 | 100 |
RoundFinished, |
13424 | 101 |
|
13421 | 102 |
ServerMessage(String), |
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
103 |
Warning(String), |
13421 | 104 |
Error(String), |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
105 |
Connected(u32), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
106 |
Unreachable, |
12136 | 107 |
} |
12141 | 108 |
|
13532 | 109 |
pub fn server_chat(msg: String) -> HWServerMessage { |
110 |
HWServerMessage::ChatMsg{ nick: "[server]".to_string(), msg } |
|
13483 | 111 |
} |
112 |
||
13427 | 113 |
impl GameCfg { |
13444 | 114 |
pub fn to_protocol(&self) -> (String, Vec<String>) { |
13671 | 115 |
use crate::server::coretypes::GameCfg::*; |
13427 | 116 |
match self { |
13444 | 117 |
FeatureSize(s) => ("FEATURE_SIZE".to_string(), vec![s.to_string()]), |
118 |
MapType(t) => ("MAP".to_string(), vec![t.to_string()]), |
|
119 |
MapGenerator(g) => ("MAPGEN".to_string(), vec![g.to_string()]), |
|
120 |
MazeSize(s) => ("MAZE_SIZE".to_string(), vec![s.to_string()]), |
|
121 |
Seed(s) => ("SEED".to_string(), vec![s.to_string()]), |
|
122 |
Template(t) => ("TEMPLATE".to_string(), vec![t.to_string()]), |
|
13427 | 123 |
|
13444 | 124 |
Ammo(n, None) => ("AMMO".to_string(), vec![n.to_string()]), |
125 |
Ammo(n, Some(s)) => ("AMMO".to_string(), vec![n.to_string(), s.to_string()]), |
|
126 |
Scheme(n, None) => ("SCHEME".to_string(), vec![n.to_string()]), |
|
127 |
Scheme(n, Some(s)) => ("SCHEME".to_string(), { |
|
13427 | 128 |
let mut v = vec![n.to_string()]; |
13444 | 129 |
v.extend(s.clone().into_iter()); |
13427 | 130 |
v |
131 |
}), |
|
13444 | 132 |
Script(s) => ("SCRIPT".to_string(), vec![s.to_string()]), |
133 |
Theme(t) => ("THEME".to_string(), vec![t.to_string()]), |
|
134 |
DrawnMap(m) => ("DRAWNMAP".to_string(), vec![m.to_string()]) |
|
13427 | 135 |
} |
136 |
} |
|
13444 | 137 |
|
138 |
pub fn to_server_msg(&self) -> HWServerMessage { |
|
139 |
use self::HWServerMessage::ConfigEntry; |
|
140 |
let (name, args) = self.to_protocol(); |
|
141 |
HWServerMessage::ConfigEntry(name, args) |
|
142 |
} |
|
13427 | 143 |
} |
144 |
||
13421 | 145 |
macro_rules! const_braces { |
146 |
($e: expr) => { "{}\n" } |
|
147 |
} |
|
148 |
||
149 |
macro_rules! msg { |
|
150 |
[$($part: expr),*] => { |
|
151 |
format!(concat!($(const_braces!($part)),*, "\n"), $($part),*); |
|
152 |
}; |
|
153 |
} |
|
154 |
||
13801 | 155 |
#[cfg(test)] |
13444 | 156 |
macro_rules! several { |
157 |
[$part: expr] => { once($part) }; |
|
158 |
[$part: expr, $($other: expr),*] => { once($part).chain(several![$($other),*]) }; |
|
159 |
} |
|
160 |
||
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
|
161 |
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
|
162 |
/** 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
|
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 |
* 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
|
165 |
*/ |
13801 | 166 |
#[cfg(test)] |
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
|
167 |
pub(crate) fn to_raw_protocol(&self) -> String { |
13437 | 168 |
use self::HWProtocolMessage::*; |
169 |
match self { |
|
170 |
Ping => msg!["PING"], |
|
171 |
Pong => msg!["PONG"], |
|
172 |
Quit(None) => msg!["QUIT"], |
|
173 |
Quit(Some(msg)) => msg!["QUIT", msg], |
|
174 |
Global(msg) => msg!["CMD", format!("GLOBAL {}", msg)], |
|
175 |
Watch(name) => msg!["CMD", format!("WATCH {}", name)], |
|
176 |
ToggleServerRegisteredOnly => msg!["CMD", "REGISTERED_ONLY"], |
|
177 |
SuperPower => msg!["CMD", "SUPER_POWER"], |
|
178 |
Info(info) => msg!["CMD", format!("INFO {}", info)], |
|
179 |
Nick(nick) => msg!("NICK", nick), |
|
180 |
Proto(version) => msg!["PROTO", version], |
|
181 |
Password(p, s) => msg!["PASSWORD", p, s], |
|
182 |
Checker(i, n, p) => msg!["CHECKER", i, n, p], |
|
183 |
List => msg!["LIST"], |
|
184 |
Chat(msg) => msg!["CHAT", msg], |
|
185 |
CreateRoom(name, None) => msg!["CREATE_ROOM", name], |
|
186 |
CreateRoom(name, Some(password)) => |
|
187 |
msg!["CREATE_ROOM", name, password], |
|
188 |
JoinRoom(name, None) => msg!["JOIN_ROOM", name], |
|
189 |
JoinRoom(name, Some(password)) => |
|
190 |
msg!["JOIN_ROOM", name, password], |
|
191 |
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
|
192 |
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
|
193 |
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
|
194 |
} 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
|
195 |
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
|
196 |
}, |
13437 | 197 |
Kick(name) => msg!["KICK", name], |
198 |
Ban(name, reason, time) => msg!["BAN", name, reason, time], |
|
199 |
BanIP(ip, reason, time) => msg!["BAN_IP", ip, reason, time], |
|
200 |
BanNick(nick, reason, time) => |
|
201 |
msg!("BAN_NICK", nick, reason, time), |
|
202 |
BanList => msg!["BANLIST"], |
|
203 |
Unban(name) => msg!["UNBAN", name], |
|
204 |
//SetServerVar(ServerVar), ??? |
|
205 |
GetServerVar => msg!["GET_SERVER_VAR"], |
|
206 |
RestartServer => msg!["CMD", "RESTART_SERVER YES"], |
|
207 |
Stats => msg!["CMD", "STATS"], |
|
208 |
Part(None) => msg!["PART"], |
|
209 |
Part(Some(msg)) => msg!["PART", msg], |
|
13444 | 210 |
Cfg(config) => { |
211 |
let (name, args) = config.to_protocol(); |
|
212 |
msg!["CFG", name, args.join("\n")] |
|
213 |
}, |
|
214 |
AddTeam(info) => |
|
13445 | 215 |
msg!["ADD_TEAM", info.name, info.color, info.grave, info.fort, |
13444 | 216 |
info.voice_pack, info.flag, info.difficulty, |
13445 | 217 |
info.hedgehogs.iter() |
218 |
.flat_map(|h| several![&h.name[..], &h.hat[..]]) |
|
219 |
.collect::<Vec<_>>().join("\n")], |
|
13437 | 220 |
RemoveTeam(name) => msg!["REMOVE_TEAM", name], |
13444 | 221 |
SetHedgehogsNumber(team, number) => msg!["HH_NUM", team, number], |
222 |
SetTeamColor(team, color) => msg!["TEAM_COLOR", team, color], |
|
13437 | 223 |
ToggleReady => msg!["TOGGLE_READY"], |
224 |
StartGame => msg!["START_GAME"], |
|
225 |
EngineMessage(msg) => msg!["EM", msg], |
|
226 |
RoundFinished => msg!["ROUNDFINISHED"], |
|
227 |
ToggleRestrictJoin => msg!["TOGGLE_RESTRICT_JOINS"], |
|
228 |
ToggleRestrictTeams => msg!["TOGGLE_RESTRICT_TEAMS"], |
|
229 |
ToggleRegisteredOnly => msg!["TOGGLE_REGISTERED_ONLY"], |
|
230 |
RoomName(name) => msg!["ROOM_NAME", name], |
|
231 |
Delegate(name) => msg!["CMD", format!("DELEGATE {}", name)], |
|
232 |
TeamChat(msg) => msg!["TEAMCHAT", msg], |
|
233 |
MaxTeams(count) => msg!["CMD", format!("MAXTEAMS {}", count)] , |
|
234 |
Fix => msg!["CMD", "FIX"], |
|
235 |
Unfix => msg!["CMD", "UNFIX"], |
|
236 |
Greeting(msg) => msg!["CMD", format!("GREETING {}", msg)], |
|
237 |
//CallVote(Option<(String, Option<String>)>) =>, ?? |
|
13486 | 238 |
Vote(msg) => msg!["CMD", format!("VOTE {}", if *msg {"YES"} else {"NO"})], |
239 |
ForceVote(msg) => msg!["CMD", format!("FORCE {}", if *msg {"YES"} else {"NO"})], |
|
13533 | 240 |
Save(name, location) => msg!["CMD", format!("SAVE {} {}", name, location)], |
241 |
Delete(name) => msg!["CMD", format!("DELETE {}", name)], |
|
242 |
SaveRoom(name) => msg!["CMD", format!("SAVEROOM {}", name)], |
|
243 |
LoadRoom(name) => msg!["CMD", format!("LOADROOM {}", name)], |
|
13437 | 244 |
Malformed => msg!["A", "QUICK", "BROWN", "HOG", "JUMPS", "OVER", "THE", "LAZY", "DOG"], |
245 |
Empty => msg![""], |
|
246 |
_ => panic!("Protocol message not yet implemented") |
|
247 |
} |
|
248 |
} |
|
249 |
} |
|
250 |
||
13529 | 251 |
fn construct_message(header: &[&str], msg: &[String]) -> String { |
13424 | 252 |
let mut v: Vec<_> = header.iter().map(|s| *s).collect(); |
253 |
v.extend(msg.iter().map(|s| &s[..])); |
|
254 |
v.push("\n"); |
|
255 |
v.join("\n") |
|
13421 | 256 |
} |
257 |
||
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
258 |
impl HWServerMessage { |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
259 |
pub fn to_raw_protocol(&self) -> String { |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
260 |
use self::HWServerMessage::*; |
12141 | 261 |
match self { |
13421 | 262 |
Ping => msg!["PING"], |
263 |
Pong => msg!["PONG"], |
|
264 |
Connected(protocol_version) => msg![ |
|
265 |
"CONNECTED", |
|
13672 | 266 |
"Hedgewars server https://www.hedgewars.org/", |
13421 | 267 |
protocol_version], |
268 |
Bye(msg) => msg!["BYE", msg], |
|
269 |
Nick(nick) => msg!["NICK", nick], |
|
270 |
Proto(proto) => msg!["PROTO", proto], |
|
13805 | 271 |
ServerAuth(hash) => msg!["SERVER_AUTH", hash], |
13421 | 272 |
LobbyLeft(nick, msg) => msg!["LOBBY:LEFT", nick, msg], |
13424 | 273 |
LobbyJoined(nicks) => |
274 |
construct_message(&["LOBBY:JOINED"], &nicks), |
|
275 |
ClientFlags(flags, nicks) => |
|
276 |
construct_message(&["CLIENT_FLAGS", flags], &nicks), |
|
277 |
Rooms(info) => |
|
278 |
construct_message(&["ROOMS"], &info), |
|
279 |
RoomAdd(info) => |
|
280 |
construct_message(&["ROOM", "ADD"], &info), |
|
281 |
RoomJoined(nicks) => |
|
282 |
construct_message(&["JOINED"], &nicks), |
|
13421 | 283 |
RoomLeft(nick, msg) => msg!["LEFT", nick, msg], |
284 |
RoomRemove(name) => msg!["ROOM", "DEL", name], |
|
13424 | 285 |
RoomUpdated(name, info) => |
286 |
construct_message(&["ROOM", "UPD", name], &info), |
|
287 |
TeamAdd(info) => |
|
288 |
construct_message(&["ADD_TEAM"], &info), |
|
289 |
TeamRemove(name) => msg!["REMOVE_TEAM", name], |
|
290 |
TeamAccepted(name) => msg!["TEAM_ACCEPTED", name], |
|
291 |
TeamColor(name, color) => msg!["TEAM_COLOR", name, color], |
|
292 |
HedgehogsNumber(name, number) => msg!["HH_NUM", name, number], |
|
13427 | 293 |
ConfigEntry(name, values) => |
294 |
construct_message(&["CFG", name], &values), |
|
13483 | 295 |
Kicked => msg!["KICKED"], |
13428 | 296 |
RunGame => msg!["RUN_GAME"], |
13433 | 297 |
ForwardEngineMessage(em) => |
298 |
construct_message(&["EM"], &em), |
|
13428 | 299 |
RoundFinished => msg!["ROUND_FINISHED"], |
13449
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13445
diff
changeset
|
300 |
ChatMsg {nick, msg} => msg!["CHAT", nick, msg], |
13421 | 301 |
ServerMessage(msg) => msg!["SERVER_MESSAGE", msg], |
302 |
Warning(msg) => msg!["WARNING", msg], |
|
303 |
Error(msg) => msg!["ERROR", msg], |
|
304 |
_ => msg!["ERROR", "UNIMPLEMENTED"], |
|
12141 | 305 |
} |
306 |
} |
|
307 |
} |