author | alfadur |
Sat, 22 Feb 2025 19:39:31 +0300 | |
changeset 16120 | 5febd2bc5372 |
parent 15852 | ea459da15b30 |
permissions | -rw-r--r-- |
15826 | 1 |
use crate::types::{GameCfg, ServerVar, TeamInfo, VoteType}; |
2 |
use std::iter::once; |
|
3 |
||
16120
5febd2bc5372
Add server reconnection tokens and anteroom local list of used nicks
alfadur
parents:
15852
diff
changeset
|
4 |
//todo!("add help message") |
5febd2bc5372
Add server reconnection tokens and anteroom local list of used nicks
alfadur
parents:
15852
diff
changeset
|
5 |
|
15826 | 6 |
#[derive(PartialEq, Eq, Clone, Debug)] |
7 |
pub enum HwProtocolMessage { |
|
8 |
// common messages |
|
9 |
Ping, |
|
10 |
Pong, |
|
11 |
Quit(Option<String>), |
|
12 |
Global(String), |
|
13 |
Watch(u32), |
|
14 |
ToggleServerRegisteredOnly, |
|
15 |
SuperPower, |
|
16 |
Info(String), |
|
17 |
// anteroom messages |
|
16120
5febd2bc5372
Add server reconnection tokens and anteroom local list of used nicks
alfadur
parents:
15852
diff
changeset
|
18 |
Nick(String, Option<String>), |
15826 | 19 |
Proto(u16), |
20 |
Password(String, String), |
|
21 |
Checker(u16, String, String), |
|
22 |
// lobby messages |
|
23 |
List, |
|
24 |
Chat(String), |
|
25 |
CreateRoom(String, Option<String>), |
|
26 |
JoinRoom(String, Option<String>), |
|
27 |
Follow(String), |
|
28 |
Rnd(Vec<String>), |
|
29 |
Kick(String), |
|
30 |
Ban(String, String, u32), |
|
31 |
BanIp(String, String, u32), |
|
32 |
BanNick(String, String, u32), |
|
33 |
BanList, |
|
34 |
Unban(String), |
|
35 |
SetServerVar(ServerVar), |
|
36 |
GetServerVar, |
|
37 |
RestartServer, |
|
38 |
Stats, |
|
39 |
// room messages |
|
40 |
Part(Option<String>), |
|
41 |
Cfg(GameCfg), |
|
42 |
AddTeam(Box<TeamInfo>), |
|
43 |
RemoveTeam(String), |
|
44 |
SetHedgehogsNumber(String, u8), |
|
45 |
SetTeamColor(String, u8), |
|
46 |
ToggleReady, |
|
47 |
StartGame, |
|
48 |
EngineMessage(String), |
|
49 |
RoundFinished, |
|
50 |
ToggleRestrictJoin, |
|
51 |
ToggleRestrictTeams, |
|
52 |
ToggleRegisteredOnly, |
|
53 |
RoomName(String), |
|
54 |
Delegate(String), |
|
55 |
TeamChat(String), |
|
56 |
MaxTeams(u8), |
|
16120
5febd2bc5372
Add server reconnection tokens and anteroom local list of used nicks
alfadur
parents:
15852
diff
changeset
|
57 |
//command line messages |
15826 | 58 |
Fix, |
59 |
Unfix, |
|
60 |
Greeting(Option<String>), |
|
61 |
CallVote(Option<VoteType>), |
|
62 |
Vote(bool), |
|
63 |
ForceVote(bool), |
|
64 |
Save(String, String), |
|
65 |
Delete(String), |
|
66 |
SaveRoom(String), |
|
67 |
LoadRoom(String), |
|
15833
a855f32ab3ca
- Update hedgewars-network-protocol library with messages needed for checker
unc0rr
parents:
15832
diff
changeset
|
68 |
CheckerReady, |
a855f32ab3ca
- Update hedgewars-network-protocol library with messages needed for checker
unc0rr
parents:
15832
diff
changeset
|
69 |
CheckedOk(Vec<String>), |
a855f32ab3ca
- Update hedgewars-network-protocol library with messages needed for checker
unc0rr
parents:
15832
diff
changeset
|
70 |
CheckedFail(String), |
15826 | 71 |
} |
72 |
||
73 |
#[derive(Debug, Clone, Copy)] |
|
74 |
pub enum ProtocolFlags { |
|
75 |
InRoom, |
|
76 |
RoomMaster, |
|
77 |
Ready, |
|
78 |
InGame, |
|
79 |
Registered, |
|
80 |
Admin, |
|
81 |
Contributor, |
|
82 |
} |
|
83 |
||
84 |
impl ProtocolFlags { |
|
85 |
#[inline] |
|
86 |
fn flag_char(&self) -> char { |
|
87 |
match self { |
|
88 |
ProtocolFlags::InRoom => 'i', |
|
89 |
ProtocolFlags::RoomMaster => 'h', |
|
90 |
ProtocolFlags::Ready => 'r', |
|
91 |
ProtocolFlags::InGame => 'g', |
|
92 |
ProtocolFlags::Registered => 'u', |
|
93 |
ProtocolFlags::Admin => 'a', |
|
94 |
ProtocolFlags::Contributor => 'c', |
|
95 |
} |
|
96 |
} |
|
97 |
||
98 |
#[inline] |
|
99 |
fn format(prefix: char, flags: &[ProtocolFlags]) -> String { |
|
100 |
once(prefix) |
|
101 |
.chain(flags.iter().map(|f| f.flag_char())) |
|
102 |
.collect() |
|
103 |
} |
|
104 |
} |
|
105 |
||
106 |
#[inline] |
|
107 |
pub fn add_flags(flags: &[ProtocolFlags]) -> String { |
|
108 |
ProtocolFlags::format('+', flags) |
|
109 |
} |
|
110 |
||
111 |
#[inline] |
|
112 |
pub fn remove_flags(flags: &[ProtocolFlags]) -> String { |
|
113 |
ProtocolFlags::format('-', flags) |
|
114 |
} |
|
115 |
||
15832
ee84e417d8d0
Add parser and idempotention tests for server messages
unc0rr
parents:
15826
diff
changeset
|
116 |
#[derive(PartialEq, Eq, Clone, Debug)] |
15826 | 117 |
pub enum HwServerMessage { |
15832
ee84e417d8d0
Add parser and idempotention tests for server messages
unc0rr
parents:
15826
diff
changeset
|
118 |
Connected(String, u32), |
15826 | 119 |
Redirect(u16), |
120 |
||
121 |
Ping, |
|
122 |
Pong, |
|
123 |
Bye(String), |
|
124 |
||
125 |
Nick(String), |
|
16120
5febd2bc5372
Add server reconnection tokens and anteroom local list of used nicks
alfadur
parents:
15852
diff
changeset
|
126 |
Token(String), |
15826 | 127 |
Proto(u16), |
128 |
AskPassword(String), |
|
129 |
ServerAuth(String), |
|
130 |
LogonPassed, |
|
131 |
||
132 |
LobbyLeft(String, String), |
|
133 |
LobbyJoined(Vec<String>), |
|
134 |
ChatMsg { nick: String, msg: String }, |
|
135 |
ClientFlags(String, Vec<String>), |
|
136 |
Rooms(Vec<String>), |
|
137 |
RoomAdd(Vec<String>), |
|
138 |
RoomJoined(Vec<String>), |
|
139 |
RoomLeft(String, String), |
|
140 |
RoomRemove(String), |
|
141 |
RoomUpdated(String, Vec<String>), |
|
142 |
Joining(String), |
|
143 |
TeamAdd(Vec<String>), |
|
144 |
TeamRemove(String), |
|
145 |
TeamAccepted(String), |
|
146 |
TeamColor(String, u8), |
|
147 |
HedgehogsNumber(String, u8), |
|
148 |
ConfigEntry(String, Vec<String>), |
|
149 |
Kicked, |
|
150 |
RunGame, |
|
151 |
ForwardEngineMessage(Vec<String>), |
|
152 |
RoundFinished, |
|
153 |
ReplayStart, |
|
154 |
||
155 |
Info(Vec<String>), |
|
156 |
ServerMessage(String), |
|
157 |
ServerVars(Vec<String>), |
|
158 |
Notice(String), |
|
159 |
Warning(String), |
|
160 |
Error(String), |
|
161 |
||
15833
a855f32ab3ca
- Update hedgewars-network-protocol library with messages needed for checker
unc0rr
parents:
15832
diff
changeset
|
162 |
Replay(Vec<String>), |
a855f32ab3ca
- Update hedgewars-network-protocol library with messages needed for checker
unc0rr
parents:
15832
diff
changeset
|
163 |
|
15826 | 164 |
//Deprecated messages |
165 |
LegacyReady(bool, Vec<String>), |
|
166 |
} |
|
167 |
||
168 |
fn special_chat(nick: &str, msg: String) -> HwServerMessage { |
|
169 |
HwServerMessage::ChatMsg { |
|
170 |
nick: nick.to_string(), |
|
171 |
msg, |
|
172 |
} |
|
173 |
} |
|
174 |
||
175 |
pub fn server_chat(msg: String) -> HwServerMessage { |
|
176 |
special_chat("[server]", msg) |
|
177 |
} |
|
178 |
||
179 |
pub fn global_chat(msg: String) -> HwServerMessage { |
|
180 |
special_chat("(global notice)", msg) |
|
181 |
} |
|
182 |
||
183 |
impl ServerVar { |
|
184 |
pub fn to_protocol(&self) -> Vec<String> { |
|
185 |
use ServerVar::*; |
|
186 |
match self { |
|
187 |
MOTDNew(s) => vec!["MOTD_NEW".to_string(), s.clone()], |
|
188 |
MOTDOld(s) => vec!["MOTD_OLD".to_string(), s.clone()], |
|
189 |
LatestProto(n) => vec!["LATEST_PROTO".to_string(), n.to_string()], |
|
190 |
} |
|
191 |
} |
|
192 |
} |
|
193 |
||
194 |
impl VoteType { |
|
195 |
pub fn to_protocol(&self) -> Vec<String> { |
|
196 |
use VoteType::*; |
|
197 |
match self { |
|
198 |
Kick(nick) => vec!["KICK".to_string(), nick.clone()], |
|
199 |
Map(None) => vec!["MAP".to_string()], |
|
200 |
Map(Some(name)) => vec!["MAP".to_string(), name.clone()], |
|
201 |
Pause => vec!["PAUSE".to_string()], |
|
202 |
NewSeed => vec!["NEWSEED".to_string()], |
|
203 |
HedgehogsPerTeam(count) => vec!["HEDGEHOGS".to_string(), count.to_string()], |
|
204 |
} |
|
205 |
} |
|
206 |
} |
|
207 |
||
208 |
impl GameCfg { |
|
209 |
pub fn to_protocol(&self) -> (String, Vec<String>) { |
|
210 |
use GameCfg::*; |
|
211 |
match self { |
|
212 |
FeatureSize(s) => ("FEATURE_SIZE".to_string(), vec![s.to_string()]), |
|
213 |
MapType(t) => ("MAP".to_string(), vec![t.to_string()]), |
|
214 |
MapGenerator(g) => ("MAPGEN".to_string(), vec![g.to_string()]), |
|
215 |
MazeSize(s) => ("MAZE_SIZE".to_string(), vec![s.to_string()]), |
|
216 |
Seed(s) => ("SEED".to_string(), vec![s.to_string()]), |
|
217 |
Template(t) => ("TEMPLATE".to_string(), vec![t.to_string()]), |
|
218 |
||
219 |
Ammo(n, None) => ("AMMO".to_string(), vec![n.to_string()]), |
|
220 |
Ammo(n, Some(s)) => ("AMMO".to_string(), vec![n.to_string(), s.to_string()]), |
|
221 |
Scheme(n, s) if s.is_empty() => ("SCHEME".to_string(), vec![n.to_string()]), |
|
222 |
Scheme(n, s) => ("SCHEME".to_string(), { |
|
223 |
let mut v = vec![n.to_string()]; |
|
224 |
v.extend(s.clone()); |
|
225 |
v |
|
226 |
}), |
|
227 |
Script(s) => ("SCRIPT".to_string(), vec![s.to_string()]), |
|
228 |
Theme(t) => ("THEME".to_string(), vec![t.to_string()]), |
|
229 |
DrawnMap(m) => ("DRAWNMAP".to_string(), vec![m.to_string()]), |
|
230 |
} |
|
231 |
} |
|
232 |
||
233 |
pub fn to_server_msg(&self) -> HwServerMessage { |
|
234 |
let (name, args) = self.to_protocol(); |
|
235 |
HwServerMessage::ConfigEntry(name, args) |
|
236 |
} |
|
237 |
} |
|
238 |
||
239 |
impl TeamInfo { |
|
240 |
pub fn to_protocol(&self) -> Vec<String> { |
|
241 |
let mut info = vec![ |
|
242 |
self.name.clone(), |
|
243 |
self.grave.clone(), |
|
244 |
self.fort.clone(), |
|
245 |
self.voice_pack.clone(), |
|
246 |
self.flag.clone(), |
|
247 |
self.owner.clone(), |
|
248 |
self.difficulty.to_string(), |
|
249 |
]; |
|
250 |
let hogs = self |
|
251 |
.hedgehogs |
|
252 |
.iter() |
|
253 |
.flat_map(|h| once(h.name.clone()).chain(once(h.hat.clone()))); |
|
254 |
info.extend(hogs); |
|
255 |
info |
|
256 |
} |
|
257 |
} |
|
258 |
||
259 |
macro_rules! const_braces { |
|
260 |
($e: expr) => { |
|
261 |
"{}\n" |
|
262 |
}; |
|
263 |
} |
|
264 |
||
265 |
macro_rules! msg { |
|
266 |
[$($part: expr),*] => { |
|
15852 | 267 |
format!(concat!($(const_braces!($part)),*, "\n"), $($part),*) |
15826 | 268 |
}; |
269 |
} |
|
270 |
||
271 |
impl HwProtocolMessage { |
|
272 |
/** Converts the message to a raw `String`, which can be sent over the network. |
|
273 |
* |
|
274 |
* This is the inverse of the `message` parser. |
|
275 |
*/ |
|
276 |
pub fn to_raw_protocol(&self) -> String { |
|
277 |
use self::HwProtocolMessage::*; |
|
278 |
match self { |
|
279 |
Ping => msg!["PING"], |
|
280 |
Pong => msg!["PONG"], |
|
281 |
Quit(None) => msg!["QUIT"], |
|
282 |
Quit(Some(msg)) => msg!["QUIT", msg], |
|
283 |
Global(msg) => msg!["CMD", format!("GLOBAL {}", msg)], |
|
284 |
Watch(name) => msg!["CMD", format!("WATCH {}", name)], |
|
285 |
ToggleServerRegisteredOnly => msg!["CMD", "REGISTERED_ONLY"], |
|
286 |
SuperPower => msg!["CMD", "SUPER_POWER"], |
|
287 |
Info(info) => msg!["CMD", format!("INFO {}", info)], |
|
16120
5febd2bc5372
Add server reconnection tokens and anteroom local list of used nicks
alfadur
parents:
15852
diff
changeset
|
288 |
Nick(nick, None) => msg!["NICK", nick], |
5febd2bc5372
Add server reconnection tokens and anteroom local list of used nicks
alfadur
parents:
15852
diff
changeset
|
289 |
Nick(nick, Some(token)) => msg!["NICK", nick, token], |
15826 | 290 |
Proto(version) => msg!["PROTO", version], |
291 |
Password(p, s) => msg!["PASSWORD", p, s], |
|
292 |
Checker(i, n, p) => msg!["CHECKER", i, n, p], |
|
293 |
List => msg!["LIST"], |
|
294 |
Chat(msg) => msg!["CHAT", msg], |
|
295 |
CreateRoom(name, None) => msg!["CREATE_ROOM", name], |
|
296 |
CreateRoom(name, Some(password)) => msg!["CREATE_ROOM", name, password], |
|
297 |
JoinRoom(name, None) => msg!["JOIN_ROOM", name], |
|
298 |
JoinRoom(name, Some(password)) => msg!["JOIN_ROOM", name, password], |
|
299 |
Follow(name) => msg!["FOLLOW", name], |
|
300 |
Rnd(args) => { |
|
301 |
if args.is_empty() { |
|
302 |
msg!["CMD", "RND"] |
|
303 |
} else { |
|
304 |
msg!["CMD", format!("RND {}", args.join(" "))] |
|
305 |
} |
|
306 |
} |
|
307 |
Kick(name) => msg!["KICK", name], |
|
308 |
Ban(name, reason, time) => msg!["BAN", name, reason, time], |
|
309 |
BanIp(ip, reason, time) => msg!["BAN_IP", ip, reason, time], |
|
310 |
BanNick(nick, reason, time) => msg!("BAN_NICK", nick, reason, time), |
|
311 |
BanList => msg!["BANLIST"], |
|
312 |
Unban(name) => msg!["UNBAN", name], |
|
313 |
SetServerVar(var) => construct_message(&["SET_SERVER_VAR"], &var.to_protocol()), |
|
314 |
GetServerVar => msg!["GET_SERVER_VAR"], |
|
315 |
RestartServer => msg!["CMD", "RESTART_SERVER YES"], |
|
316 |
Stats => msg!["CMD", "STATS"], |
|
317 |
Part(None) => msg!["PART"], |
|
318 |
Part(Some(msg)) => msg!["PART", msg], |
|
319 |
Cfg(config) => { |
|
320 |
let (name, args) = config.to_protocol(); |
|
321 |
msg!["CFG", name, args.join("\n")] |
|
322 |
} |
|
323 |
AddTeam(info) => msg![ |
|
324 |
"ADD_TEAM", |
|
325 |
info.name, |
|
326 |
info.color, |
|
327 |
info.grave, |
|
328 |
info.fort, |
|
329 |
info.voice_pack, |
|
330 |
info.flag, |
|
331 |
info.difficulty, |
|
332 |
&(info.hedgehogs.iter()) |
|
333 |
.flat_map(|h| [&h.name[..], &h.hat[..]]) |
|
334 |
.collect::<Vec<_>>() |
|
335 |
.join("\n") |
|
336 |
], |
|
337 |
RemoveTeam(name) => msg!["REMOVE_TEAM", name], |
|
338 |
SetHedgehogsNumber(team, number) => msg!["HH_NUM", team, number], |
|
339 |
SetTeamColor(team, color) => msg!["TEAM_COLOR", team, color], |
|
340 |
ToggleReady => msg!["TOGGLE_READY"], |
|
341 |
StartGame => msg!["START_GAME"], |
|
342 |
EngineMessage(msg) => msg!["EM", msg], |
|
343 |
RoundFinished => msg!["ROUNDFINISHED"], |
|
344 |
ToggleRestrictJoin => msg!["TOGGLE_RESTRICT_JOINS"], |
|
345 |
ToggleRestrictTeams => msg!["TOGGLE_RESTRICT_TEAMS"], |
|
346 |
ToggleRegisteredOnly => msg!["TOGGLE_REGISTERED_ONLY"], |
|
347 |
RoomName(name) => msg!["ROOM_NAME", name], |
|
348 |
Delegate(name) => msg!["CMD", format!("DELEGATE {}", name)], |
|
349 |
TeamChat(msg) => msg!["TEAMCHAT", msg], |
|
350 |
MaxTeams(count) => msg!["CMD", format!("MAXTEAMS {}", count)], |
|
351 |
Fix => msg!["CMD", "FIX"], |
|
352 |
Unfix => msg!["CMD", "UNFIX"], |
|
353 |
Greeting(None) => msg!["CMD", "GREETING"], |
|
354 |
Greeting(Some(msg)) => msg!["CMD", format!("GREETING {}", msg)], |
|
355 |
CallVote(None) => msg!["CMD", "CALLVOTE"], |
|
356 |
CallVote(Some(vote)) => { |
|
357 |
msg!["CMD", format!("CALLVOTE {}", &vote.to_protocol().join(" "))] |
|
358 |
} |
|
359 |
Vote(msg) => msg!["CMD", format!("VOTE {}", if *msg { "YES" } else { "NO" })], |
|
360 |
ForceVote(msg) => msg!["CMD", format!("FORCE {}", if *msg { "YES" } else { "NO" })], |
|
361 |
Save(name, location) => msg!["CMD", format!("SAVE {} {}", name, location)], |
|
362 |
Delete(name) => msg!["CMD", format!("DELETE {}", name)], |
|
363 |
SaveRoom(name) => msg!["CMD", format!("SAVEROOM {}", name)], |
|
364 |
LoadRoom(name) => msg!["CMD", format!("LOADROOM {}", name)], |
|
15833
a855f32ab3ca
- Update hedgewars-network-protocol library with messages needed for checker
unc0rr
parents:
15832
diff
changeset
|
365 |
CheckerReady => msg!["READY"], |
a855f32ab3ca
- Update hedgewars-network-protocol library with messages needed for checker
unc0rr
parents:
15832
diff
changeset
|
366 |
CheckedOk(args) => msg!["CHECKED", "OK", args.join("\n")], |
a855f32ab3ca
- Update hedgewars-network-protocol library with messages needed for checker
unc0rr
parents:
15832
diff
changeset
|
367 |
CheckedFail(message) => msg!["CHECKED", "FAIL", message], |
15826 | 368 |
} |
369 |
} |
|
370 |
} |
|
371 |
||
372 |
fn construct_message(header: &[&str], msg: &[String]) -> String { |
|
373 |
let mut v: Vec<_> = header.iter().cloned().collect(); |
|
374 |
v.extend(msg.iter().map(|s| &s[..])); |
|
375 |
v.push("\n"); |
|
376 |
v.join("\n") |
|
377 |
} |
|
378 |
||
379 |
impl HwServerMessage { |
|
380 |
pub fn to_raw_protocol(&self) -> String { |
|
381 |
use self::HwServerMessage::*; |
|
382 |
match self { |
|
383 |
Ping => msg!["PING"], |
|
384 |
Pong => msg!["PONG"], |
|
15832
ee84e417d8d0
Add parser and idempotention tests for server messages
unc0rr
parents:
15826
diff
changeset
|
385 |
Connected(message, protocol_version) => msg!["CONNECTED", message, protocol_version], |
15826 | 386 |
Redirect(port) => msg!["REDIRECT", port], |
387 |
Bye(msg) => msg!["BYE", msg], |
|
388 |
Nick(nick) => msg!["NICK", nick], |
|
16120
5febd2bc5372
Add server reconnection tokens and anteroom local list of used nicks
alfadur
parents:
15852
diff
changeset
|
389 |
Token(token) => msg!["TOKEN", token], |
15826 | 390 |
Proto(proto) => msg!["PROTO", proto], |
391 |
AskPassword(salt) => msg!["ASKPASSWORD", salt], |
|
392 |
ServerAuth(hash) => msg!["SERVER_AUTH", hash], |
|
393 |
LogonPassed => msg!["LOGONPASSED"], |
|
394 |
LobbyLeft(nick, msg) => msg!["LOBBY:LEFT", nick, msg], |
|
395 |
LobbyJoined(nicks) => construct_message(&["LOBBY:JOINED"], &nicks), |
|
396 |
ClientFlags(flags, nicks) => construct_message(&["CLIENT_FLAGS", flags], &nicks), |
|
397 |
Rooms(info) => construct_message(&["ROOMS"], &info), |
|
398 |
RoomAdd(info) => construct_message(&["ROOM", "ADD"], &info), |
|
399 |
RoomJoined(nicks) => construct_message(&["JOINED"], &nicks), |
|
400 |
RoomLeft(nick, msg) => msg!["LEFT", nick, msg], |
|
401 |
RoomRemove(name) => msg!["ROOM", "DEL", name], |
|
402 |
RoomUpdated(name, info) => construct_message(&["ROOM", "UPD", name], &info), |
|
403 |
Joining(name) => msg!["JOINING", name], |
|
404 |
TeamAdd(info) => construct_message(&["ADD_TEAM"], &info), |
|
405 |
TeamRemove(name) => msg!["REMOVE_TEAM", name], |
|
406 |
TeamAccepted(name) => msg!["TEAM_ACCEPTED", name], |
|
407 |
TeamColor(name, color) => msg!["TEAM_COLOR", name, color], |
|
408 |
HedgehogsNumber(name, number) => msg!["HH_NUM", name, number], |
|
409 |
ConfigEntry(name, values) => construct_message(&["CFG", name], &values), |
|
410 |
Kicked => msg!["KICKED"], |
|
411 |
RunGame => msg!["RUN_GAME"], |
|
412 |
ForwardEngineMessage(em) => construct_message(&["EM"], &em), |
|
413 |
RoundFinished => msg!["ROUND_FINISHED"], |
|
414 |
ChatMsg { nick, msg } => msg!["CHAT", nick, msg], |
|
415 |
Info(info) => construct_message(&["INFO"], &info), |
|
416 |
ServerMessage(msg) => msg!["SERVER_MESSAGE", msg], |
|
417 |
ServerVars(vars) => construct_message(&["SERVER_VARS"], &vars), |
|
418 |
Notice(msg) => msg!["NOTICE", msg], |
|
419 |
Warning(msg) => msg!["WARNING", msg], |
|
420 |
Error(msg) => msg!["ERROR", msg], |
|
421 |
ReplayStart => msg!["REPLAY_START"], |
|
15833
a855f32ab3ca
- Update hedgewars-network-protocol library with messages needed for checker
unc0rr
parents:
15832
diff
changeset
|
422 |
Replay(em) => construct_message(&["REPLAY"], &em), |
15826 | 423 |
|
424 |
LegacyReady(is_ready, nicks) => { |
|
425 |
construct_message(&[if *is_ready { "READY" } else { "NOT_READY" }], &nicks) |
|
426 |
} |
|
427 |
} |
|
428 |
} |
|
429 |
} |