author | unC0Rr |
Wed, 28 Aug 2024 13:41:51 +0200 | |
changeset 16049 | 9be943326d9c |
parent 16033 | 2871fc57a282 |
permissions | -rw-r--r-- |
15826 | 1 |
use super::{ |
2 |
actions::{Destination, DestinationGroup}, |
|
3 |
Response, |
|
4 |
}; |
|
16033 | 5 |
use crate::core::server::HwRoomOrServer; |
15826 | 6 |
use crate::handlers::actions::ToPendingMessage; |
13666 | 7 |
use crate::{ |
15096 | 8 |
core::{ |
9 |
client::HwClient, |
|
10 |
room::HwRoom, |
|
15547 | 11 |
server::{ |
12 |
EndGameResult, HwRoomControl, HwServer, JoinRoomError, LeaveRoomResult, StartGameError, |
|
16015 | 13 |
VoteEffect, VoteError, VoteResult, |
15547 | 14 |
}, |
15826 | 15 |
types::{ClientId, RoomId}, |
15096 | 16 |
}, |
15826 | 17 |
utils::to_engine_msg, |
18 |
}; |
|
19 |
use hedgewars_network_protocol::{ |
|
20 |
messages::{ |
|
15096 | 21 |
add_flags, remove_flags, server_chat, |
22 |
HwProtocolMessage::{self, Rnd}, |
|
23 |
HwServerMessage::{self, *}, |
|
14803 | 24 |
ProtocolFlags as Flags, |
14478 | 25 |
}, |
15826 | 26 |
types::{GameCfg, RoomConfig, TeamInfo, Vote, VoteType, MAX_HEDGEHOGS_PER_TEAM}, |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
27 |
}; |
14718 | 28 |
use rand::{self, seq::SliceRandom, thread_rng, Rng}; |
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
29 |
use std::{iter::once, mem::replace}; |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
30 |
|
15096 | 31 |
pub fn rnd_reply(options: &[String]) -> HwServerMessage { |
13492 | 32 |
let mut rng = thread_rng(); |
14718 | 33 |
|
13492 | 34 |
let reply = if options.is_empty() { |
14718 | 35 |
(*&["heads", "tails"].choose(&mut rng).unwrap()).to_string() |
13445
d3c86ade3d4d
Send the rnd reply to the room only.
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13444
diff
changeset
|
36 |
} else { |
14718 | 37 |
options.choose(&mut rng).unwrap().clone() |
13492 | 38 |
}; |
13445
d3c86ade3d4d
Send the rnd reply to the room only.
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13444
diff
changeset
|
39 |
|
13492 | 40 |
ChatMsg { |
14718 | 41 |
nick: "[random]".to_string(), |
42 |
msg: reply, |
|
13492 | 43 |
} |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
44 |
} |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
45 |
|
15465 | 46 |
pub fn get_lobby_join_data(server: &HwServer, response: &mut Response) { |
14704
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
47 |
let client_id = response.client_id(); |
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
48 |
|
15465 | 49 |
let client = server.client(client_id); |
14812 | 50 |
let nick = vec![client.nick.clone()]; |
51 |
let mut flags = vec![]; |
|
52 |
if client.is_registered() { |
|
53 |
flags.push(Flags::Registered) |
|
54 |
} |
|
55 |
if client.is_admin() { |
|
56 |
flags.push(Flags::Admin) |
|
57 |
} |
|
58 |
if client.is_contributor() { |
|
59 |
flags.push(Flags::Contributor) |
|
60 |
} |
|
14704
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
61 |
|
14812 | 62 |
let all_nicks: Vec<_> = server.collect_nicks(|_| true); |
14704
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
63 |
|
14812 | 64 |
let mut flag_selectors = [ |
65 |
( |
|
66 |
Flags::Registered, |
|
67 |
server.collect_nicks(|(_, c)| c.is_registered()), |
|
68 |
), |
|
69 |
(Flags::Admin, server.collect_nicks(|(_, c)| c.is_admin())), |
|
70 |
( |
|
71 |
Flags::Contributor, |
|
72 |
server.collect_nicks(|(_, c)| c.is_contributor()), |
|
73 |
), |
|
74 |
( |
|
75 |
Flags::InRoom, |
|
76 |
server.collect_nicks(|(_, c)| c.room_id.is_some()), |
|
77 |
), |
|
78 |
]; |
|
79 |
||
15465 | 80 |
let server_msg = ServerMessage(server.get_greetings(client).to_string()); |
14704
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
81 |
|
14802 | 82 |
let rooms_msg = Rooms( |
15545
f4f6060b536c
add a separate interface for modifying room state
alfadur <mail@none>
parents:
15544
diff
changeset
|
83 |
server |
f4f6060b536c
add a separate interface for modifying room state
alfadur <mail@none>
parents:
15544
diff
changeset
|
84 |
.iter_rooms() |
15544 | 85 |
.filter(|r| r.protocol_number == client.protocol_number) |
86 |
.flat_map(|r| r.info(r.master_id.map(|id| server.client(id)))) |
|
14802 | 87 |
.collect(), |
88 |
); |
|
14704
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
89 |
|
14812 | 90 |
response.add(LobbyJoined(nick).send_all().but_self()); |
91 |
response.add( |
|
92 |
ClientFlags(add_flags(&flags), all_nicks.clone()) |
|
93 |
.send_all() |
|
94 |
.but_self(), |
|
95 |
); |
|
96 |
||
97 |
response.add(LobbyJoined(all_nicks).send_self()); |
|
98 |
for (flag, nicks) in &mut flag_selectors { |
|
14912 | 99 |
if !nicks.is_empty() { |
100 |
response.add(ClientFlags(add_flags(&[*flag]), replace(nicks, vec![])).send_self()); |
|
101 |
} |
|
14812 | 102 |
} |
103 |
||
14802 | 104 |
response.add(server_msg.send_self()); |
105 |
response.add(rooms_msg.send_self()); |
|
14704
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
106 |
} |
932ff7683653
Server action refactoring part 8 of N
alfadur <mail@none>
parents:
14696
diff
changeset
|
107 |
|
15463 | 108 |
pub fn get_room_join_data<'a, I: Iterator<Item = &'a HwClient> + Clone>( |
109 |
client: &HwClient, |
|
16030 | 110 |
master: Option<&HwClient>, |
15463 | 111 |
room: &HwRoom, |
112 |
room_clients: I, |
|
14808 | 113 |
response: &mut Response, |
114 |
) { |
|
15463 | 115 |
#[inline] |
15556 | 116 |
fn partition_nicks<'a, I, F>(clients: I, f: F) -> (Vec<String>, Vec<String>) |
15463 | 117 |
where |
15556 | 118 |
I: Iterator<Item = &'a HwClient> + Clone, |
15463 | 119 |
F: Fn(&&'a HwClient) -> bool, |
120 |
{ |
|
15556 | 121 |
( |
122 |
clients |
|
123 |
.clone() |
|
124 |
.filter(|c| f(c)) |
|
125 |
.map(|c| &c.nick) |
|
126 |
.cloned() |
|
127 |
.collect(), |
|
128 |
clients |
|
129 |
.filter(|c| !f(c)) |
|
130 |
.map(|c| &c.nick) |
|
131 |
.cloned() |
|
132 |
.collect(), |
|
133 |
) |
|
15463 | 134 |
} |
14808 | 135 |
|
15463 | 136 |
let nick = client.nick.clone(); |
15556 | 137 |
response.add( |
138 |
RoomJoined(vec![nick.clone()]) |
|
139 |
.send_all() |
|
140 |
.in_room(room.id) |
|
141 |
.but_self(), |
|
142 |
); |
|
15557
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
143 |
response.add(ClientFlags(add_flags(&[Flags::InRoom]), vec![nick.clone()]).send_all()); |
16032 | 144 |
let nicks = once(nick.clone()) |
145 |
.chain( |
|
146 |
room_clients |
|
147 |
.clone() |
|
148 |
.filter(|c| c.id != client.id) |
|
149 |
.map(|c| c.nick.clone()), |
|
150 |
) |
|
151 |
.collect(); |
|
152 |
||
14808 | 153 |
response.add(RoomJoined(nicks).send_self()); |
154 |
||
14820 | 155 |
let mut flag_selectors = [ |
156 |
( |
|
157 |
Flags::RoomMaster, |
|
15556 | 158 |
partition_nicks(room_clients.clone(), |c| c.is_master()), |
14820 | 159 |
), |
15463 | 160 |
( |
161 |
Flags::Ready, |
|
15556 | 162 |
partition_nicks(room_clients.clone(), |c| c.is_ready()), |
15463 | 163 |
), |
164 |
( |
|
165 |
Flags::InGame, |
|
15556 | 166 |
partition_nicks(room_clients.clone(), |c| c.is_in_game()), |
15463 | 167 |
), |
14820 | 168 |
]; |
169 |
||
15556 | 170 |
for (flag, (set_nicks, cleared_nicks)) in &mut flag_selectors { |
171 |
if !set_nicks.is_empty() { |
|
172 |
response.add(ClientFlags(add_flags(&[*flag]), replace(set_nicks, vec![])).send_self()); |
|
173 |
} |
|
174 |
||
175 |
if !cleared_nicks.is_empty() { |
|
176 |
response.add( |
|
177 |
ClientFlags(remove_flags(&[*flag]), replace(cleared_nicks, vec![])).send_self(), |
|
178 |
); |
|
179 |
} |
|
14820 | 180 |
} |
14808 | 181 |
|
15575 | 182 |
get_active_room_teams(room, Destination::ToSelf, response); |
183 |
get_active_room_config(room, Destination::ToSelf, response); |
|
15557
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
184 |
|
14808 | 185 |
if !room.greeting.is_empty() { |
186 |
response.add( |
|
187 |
ChatMsg { |
|
188 |
nick: "[greeting]".to_string(), |
|
189 |
msg: room.greeting.clone(), |
|
190 |
} |
|
191 |
.send_self(), |
|
192 |
); |
|
193 |
} |
|
15557
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
194 |
|
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
195 |
if let Some(info) = &room.game_info { |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
196 |
response.add( |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
197 |
ClientFlags(add_flags(&[Flags::Ready, Flags::InGame]), vec![nick]) |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
198 |
.send_all() |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
199 |
.in_room(room.id), |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
200 |
); |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
201 |
response.add(RunGame.send_self()); |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
202 |
|
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
203 |
response.add( |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
204 |
ForwardEngineMessage( |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
205 |
once(to_engine_msg("e$spectate 1".bytes())) |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
206 |
.chain(info.msg_log.iter().cloned()) |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
207 |
.collect(), |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
208 |
) |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
209 |
.send_self(), |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
210 |
); |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
211 |
|
15562 | 212 |
for team in info.client_teams(client.id) { |
15557
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
213 |
response.add( |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
214 |
ForwardEngineMessage(vec![to_engine_msg(once(b'G').chain(team.name.bytes()))]) |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
215 |
.send_all() |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
216 |
.in_room(room.id), |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
217 |
); |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
218 |
} |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
219 |
|
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
220 |
if info.is_paused { |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
221 |
response.add(ForwardEngineMessage(vec![to_engine_msg(once(b'I'))]).send_self()); |
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
222 |
} |
15591 | 223 |
|
16029 | 224 |
for original_team in &info.original_teams { |
225 |
if let Some(team) = room.find_team(|team| team.name == original_team.info.name) { |
|
226 |
if *team != original_team.info { |
|
227 |
response.add(TeamRemove(original_team.info.name.clone()).send_self()); |
|
15719 | 228 |
response.add(TeamAdd(team.to_protocol()).send_self()); |
15591 | 229 |
} |
230 |
} else { |
|
16029 | 231 |
response.add(TeamRemove(original_team.info.name.clone()).send_self()); |
15591 | 232 |
} |
233 |
} |
|
234 |
||
16029 | 235 |
for team in &room.teams { |
236 |
if !info |
|
237 |
.original_teams |
|
238 |
.iter() |
|
239 |
.any(|original_team| original_team.info.name == team.info.name) |
|
240 |
{ |
|
241 |
response.add(TeamAdd(team.info.to_protocol()).send_self()); |
|
15719 | 242 |
} |
243 |
} |
|
244 |
||
15591 | 245 |
get_room_config_impl(room.config(), Destination::ToSelf, response); |
15557
3f6a7a867040
add back em response on joining a game in progress
alfadur <mail@none>
parents:
15556
diff
changeset
|
246 |
} |
16030 | 247 |
|
248 |
get_room_update(None, room, master, response); |
|
14808 | 249 |
} |
250 |
||
15463 | 251 |
pub fn get_room_join_error(error: JoinRoomError, response: &mut Response) { |
252 |
use super::strings::*; |
|
253 |
match error { |
|
254 |
JoinRoomError::DoesntExist => response.warn(NO_ROOM), |
|
15556 | 255 |
JoinRoomError::WrongProtocol => response.warn(INCOMPATIBLE_ROOM_PROTOCOL), |
15555 | 256 |
JoinRoomError::WrongPassword => { |
257 |
response.add(Notice("WrongPassword".to_string()).send_self()) |
|
258 |
} |
|
15463 | 259 |
JoinRoomError::Full => response.warn(ROOM_FULL), |
260 |
JoinRoomError::Restricted => response.warn(ROOM_JOIN_RESTRICTED), |
|
15556 | 261 |
JoinRoomError::RegistrationRequired => response.warn(ROOM_REGISTRATION_REQUIRED), |
15463 | 262 |
} |
263 |
} |
|
264 |
||
15504 | 265 |
pub fn get_remove_teams_data( |
266 |
room_id: RoomId, |
|
267 |
was_in_game: bool, |
|
268 |
removed_teams: Vec<String>, |
|
269 |
response: &mut Response, |
|
270 |
) { |
|
271 |
if was_in_game { |
|
272 |
for team_name in &removed_teams { |
|
273 |
let remove_msg = to_engine_msg(once(b'F').chain(team_name.bytes())); |
|
14711
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
274 |
|
15504 | 275 |
response.add( |
276 |
ForwardEngineMessage(vec![remove_msg]) |
|
277 |
.send_all() |
|
278 |
.in_room(room_id) |
|
279 |
.but_self(), |
|
280 |
); |
|
281 |
} |
|
15563 | 282 |
} else { |
283 |
for team_name in removed_teams { |
|
284 |
response.add(TeamRemove(team_name).send_all().in_room(room_id)); |
|
285 |
} |
|
15504 | 286 |
} |
287 |
} |
|
14711
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
288 |
|
15514 | 289 |
pub fn get_room_leave_result( |
15504 | 290 |
server: &HwServer, |
291 |
room: &HwRoom, |
|
292 |
leave_message: &str, |
|
293 |
result: LeaveRoomResult, |
|
294 |
response: &mut Response, |
|
295 |
) { |
|
296 |
let client = server.client(response.client_id); |
|
297 |
response.add(ClientFlags(remove_flags(&[Flags::InRoom]), vec![client.nick.clone()]).send_all()); |
|
298 |
||
15538 | 299 |
match result { |
15504 | 300 |
LeaveRoomResult::RoomRemoved => { |
301 |
response.add( |
|
302 |
RoomRemove(room.name.clone()) |
|
303 |
.send_all() |
|
304 |
.with_protocol(room.protocol_number), |
|
305 |
); |
|
306 |
} |
|
14711
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
307 |
|
15504 | 308 |
LeaveRoomResult::RoomRemains { |
309 |
is_empty, |
|
310 |
was_master, |
|
311 |
new_master, |
|
312 |
was_in_game, |
|
313 |
removed_teams, |
|
314 |
} => { |
|
315 |
if !is_empty { |
|
316 |
response.add( |
|
317 |
RoomLeft(client.nick.clone(), leave_message.to_string()) |
|
318 |
.send_all() |
|
319 |
.in_room(room.id) |
|
320 |
.but_self(), |
|
321 |
); |
|
322 |
} |
|
14819 | 323 |
|
15504 | 324 |
if was_master { |
325 |
response.add( |
|
326 |
ClientFlags( |
|
327 |
remove_flags(&[Flags::RoomMaster]), |
|
328 |
vec![client.nick.clone()], |
|
329 |
) |
|
330 |
.send_all() |
|
331 |
.in_room(room.id), |
|
332 |
); |
|
14819 | 333 |
|
15504 | 334 |
if let Some(new_master_id) = new_master { |
335 |
let new_master_nick = server.client(new_master_id).nick.clone(); |
|
14819 | 336 |
response.add( |
337 |
ClientFlags(add_flags(&[Flags::RoomMaster]), vec![new_master_nick]) |
|
338 |
.send_all() |
|
339 |
.in_room(room.id), |
|
340 |
); |
|
14715 | 341 |
} |
14711
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
342 |
} |
15504 | 343 |
|
344 |
get_remove_teams_data(room.id, was_in_game, removed_teams, response); |
|
345 |
||
16030 | 346 |
let master = new_master.or(Some(client.id)).map(|id| server.client(id)); |
347 |
||
15504 | 348 |
response.add( |
16030 | 349 |
RoomUpdated(room.name.clone(), room.info(master)) |
15504 | 350 |
.send_all() |
351 |
.with_protocol(room.protocol_number), |
|
352 |
); |
|
14711
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
353 |
} |
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
354 |
} |
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
355 |
} |
f61ce544d436
Server action refactoring part N of N
alfadur <mail@none>
parents:
14710
diff
changeset
|
356 |
|
15096 | 357 |
pub fn remove_client(server: &mut HwServer, response: &mut Response, msg: String) { |
14695
b87c71ccd17d
Server action refactoring part 5 of N
alfadur <mail@none>
parents:
14694
diff
changeset
|
358 |
let client_id = response.client_id(); |
15504 | 359 |
let client = server.client(client_id); |
14718 | 360 |
let nick = client.nick.clone(); |
14695
b87c71ccd17d
Server action refactoring part 5 of N
alfadur <mail@none>
parents:
14694
diff
changeset
|
361 |
|
16033 | 362 |
match server.get_room_control(client_id) { |
363 |
HwRoomOrServer::Room(mut control) => { |
|
364 |
let room_id = control.room().id; |
|
365 |
let result = control.leave_room(); |
|
366 |
let server = control.server(); |
|
367 |
get_room_leave_result(server, server.room(room_id), &msg, result, response); |
|
368 |
} |
|
369 |
_ => (), |
|
15504 | 370 |
} |
14695
b87c71ccd17d
Server action refactoring part 5 of N
alfadur <mail@none>
parents:
14694
diff
changeset
|
371 |
|
b87c71ccd17d
Server action refactoring part 5 of N
alfadur <mail@none>
parents:
14694
diff
changeset
|
372 |
server.remove_client(client_id); |
b87c71ccd17d
Server action refactoring part 5 of N
alfadur <mail@none>
parents:
14694
diff
changeset
|
373 |
|
15465 | 374 |
response.add(LobbyLeft(nick, msg.clone()).send_all()); |
375 |
response.add(Bye(msg).send_self()); |
|
14717 | 376 |
response.remove_client(client_id); |
14694
08a8605bafaf
Server action refactoring part 4 of N
alfadur <mail@none>
parents:
14478
diff
changeset
|
377 |
} |
08a8605bafaf
Server action refactoring part 4 of N
alfadur <mail@none>
parents:
14478
diff
changeset
|
378 |
|
14707
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
379 |
pub fn get_room_update( |
16030 | 380 |
old_name: Option<String>, |
15096 | 381 |
room: &HwRoom, |
382 |
master: Option<&HwClient>, |
|
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
383 |
response: &mut Response, |
14707
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
384 |
) { |
16030 | 385 |
let update_msg = RoomUpdated(old_name.unwrap_or(room.name.clone()), room.info(master)); |
14707
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
386 |
response.add(update_msg.send_all().with_protocol(room.protocol_number)); |
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
387 |
} |
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
388 |
|
15565 | 389 |
pub fn get_room_config_impl( |
390 |
config: &RoomConfig, |
|
391 |
destination: Destination, |
|
392 |
response: &mut Response, |
|
393 |
) { |
|
394 |
response.add( |
|
395 |
ConfigEntry("FULLMAPCONFIG".to_string(), config.to_map_config()) |
|
396 |
.send_to_destination(destination.clone()), |
|
397 |
); |
|
14806
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
398 |
for cfg in config.to_game_config() { |
15565 | 399 |
response.add(cfg.to_server_msg().send_to_destination(destination.clone())); |
14806
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
400 |
} |
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
401 |
} |
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
402 |
|
15575 | 403 |
pub fn get_active_room_config(room: &HwRoom, destination: Destination, response: &mut Response) { |
15565 | 404 |
get_room_config_impl(room.active_config(), destination, response); |
14806
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
405 |
} |
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
406 |
|
15565 | 407 |
pub fn get_teams<'a, I>(teams: I, destination: Destination, response: &mut Response) |
14806
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
408 |
where |
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
409 |
I: Iterator<Item = &'a TeamInfo>, |
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
410 |
{ |
a1077e8d26f4
implement watch message apart from replay deserializing
alfadur
parents:
14805
diff
changeset
|
411 |
for team in teams { |
15565 | 412 |
response.add(TeamAdd(team.to_protocol()).send_to_destination(destination.clone())); |
413 |
response |
|
414 |
.add(TeamColor(team.name.clone(), team.color).send_to_destination(destination.clone())); |
|
415 |
response.add( |
|
416 |
HedgehogsNumber(team.name.clone(), team.hedgehogs_number) |
|
417 |
.send_to_destination(destination.clone()), |
|
418 |
); |
|
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
419 |
} |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
420 |
} |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
421 |
|
15575 | 422 |
pub fn get_active_room_teams(room: &HwRoom, destination: Destination, response: &mut Response) { |
15562 | 423 |
let current_teams = match room.game_info { |
15563 | 424 |
Some(ref info) => &info.original_teams, |
15562 | 425 |
None => &room.teams, |
426 |
}; |
|
427 |
||
16029 | 428 |
get_teams( |
429 |
current_teams.iter().map(|team| &team.info), |
|
430 |
destination, |
|
431 |
response, |
|
432 |
); |
|
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
433 |
} |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
434 |
|
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
435 |
pub fn get_room_flags( |
15096 | 436 |
server: &HwServer, |
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
437 |
room_id: RoomId, |
15565 | 438 |
destination: Destination, |
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
439 |
response: &mut Response, |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
440 |
) { |
15544 | 441 |
let room = server.room(room_id); |
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
442 |
if let Some(id) = room.master_id { |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
443 |
response.add( |
14803 | 444 |
ClientFlags( |
445 |
add_flags(&[Flags::RoomMaster]), |
|
15514 | 446 |
vec![server.client(id).nick.clone()], |
14803 | 447 |
) |
15565 | 448 |
.send_to_destination(destination.clone()), |
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
449 |
); |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
450 |
} |
15514 | 451 |
let nicks = server.collect_nicks(|(_, c)| c.room_id == Some(room_id) && c.is_ready()); |
452 |
||
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
453 |
if !nicks.is_empty() { |
15565 | 454 |
response |
455 |
.add(ClientFlags(add_flags(&[Flags::Ready]), nicks).send_to_destination(destination)); |
|
14710
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
456 |
} |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
457 |
} |
aae29ba56aec
Server action refactoring part C of N
alfadur <mail@none>
parents:
14709
diff
changeset
|
458 |
|
15547 | 459 |
pub fn check_vote( |
460 |
server: &HwServer, |
|
461 |
room: &HwRoom, |
|
462 |
kind: &VoteType, |
|
463 |
response: &mut Response, |
|
464 |
) -> bool { |
|
465 |
let error = match &kind { |
|
466 |
VoteType::Kick(nick) => { |
|
467 |
if server |
|
468 |
.find_client(&nick) |
|
469 |
.filter(|c| c.room_id == Some(room.id)) |
|
470 |
.is_some() |
|
471 |
{ |
|
472 |
None |
|
473 |
} else { |
|
474 |
Some("/callvote kick: No such user!".to_string()) |
|
475 |
} |
|
476 |
} |
|
477 |
VoteType::Map(None) => { |
|
478 |
let names: Vec<_> = room.saves.keys().cloned().collect(); |
|
479 |
if names.is_empty() { |
|
480 |
Some("/callvote map: No maps saved in this room!".to_string()) |
|
481 |
} else { |
|
482 |
Some(format!("Available maps: {}", names.join(", "))) |
|
483 |
} |
|
484 |
} |
|
485 |
VoteType::Map(Some(name)) => { |
|
486 |
if room.saves.get(&name[..]).is_some() { |
|
487 |
None |
|
488 |
} else { |
|
489 |
Some("/callvote map: No such map!".to_string()) |
|
490 |
} |
|
491 |
} |
|
492 |
VoteType::Pause => { |
|
493 |
if room.game_info.is_some() { |
|
494 |
None |
|
495 |
} else { |
|
496 |
Some("/callvote pause: No game in progress!".to_string()) |
|
497 |
} |
|
498 |
} |
|
499 |
VoteType::NewSeed => None, |
|
500 |
VoteType::HedgehogsPerTeam(number) => match number { |
|
501 |
1..=MAX_HEDGEHOGS_PER_TEAM => None, |
|
502 |
_ => Some("/callvote hedgehogs: Specify number from 1 to 8.".to_string()), |
|
503 |
}, |
|
504 |
}; |
|
505 |
||
506 |
match error { |
|
507 |
None => true, |
|
508 |
Some(msg) => { |
|
509 |
response.add(server_chat(msg).send_self()); |
|
510 |
false |
|
511 |
} |
|
512 |
} |
|
513 |
} |
|
514 |
||
515 |
pub fn get_vote_data( |
|
14708
5122c584804e
Server action refactoring part A of N
alfadur <mail@none>
parents:
14707
diff
changeset
|
516 |
room_id: RoomId, |
15547 | 517 |
result: &Result<VoteResult, VoteError>, |
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
518 |
response: &mut Response, |
14708
5122c584804e
Server action refactoring part A of N
alfadur <mail@none>
parents:
14707
diff
changeset
|
519 |
) { |
15547 | 520 |
match result { |
521 |
Ok(VoteResult::Submitted) => { |
|
522 |
response.add(server_chat("Your vote has been counted.".to_string()).send_self()) |
|
523 |
} |
|
15817 | 524 |
Ok(VoteResult::Succeeded(_) | VoteResult::Failed) => response.add( |
15547 | 525 |
server_chat("Voting closed.".to_string()) |
526 |
.send_all() |
|
527 |
.in_room(room_id), |
|
528 |
), |
|
529 |
Err(VoteError::NoVoting) => { |
|
530 |
response.add(server_chat("There's no voting going on.".to_string()).send_self()) |
|
531 |
} |
|
532 |
Err(VoteError::AlreadyVoted) => { |
|
533 |
response.add(server_chat("You already have voted.".to_string()).send_self()) |
|
534 |
} |
|
535 |
} |
|
536 |
} |
|
537 |
||
538 |
pub fn handle_vote( |
|
16015 | 539 |
room_control: HwRoomControl, |
15547 | 540 |
result: Result<VoteResult, VoteError>, |
541 |
response: &mut super::Response, |
|
542 |
) { |
|
543 |
let room_id = room_control.room().id; |
|
16015 | 544 |
get_vote_data(room_control.room().id, &result, response); |
15547 | 545 |
|
16015 | 546 |
if let Ok(VoteResult::Succeeded(effect)) = result { |
547 |
match effect { |
|
548 |
VoteEffect::Kicked(kicked_id, leave_result) => { |
|
549 |
response.add(Kicked.send(kicked_id)); |
|
550 |
get_room_leave_result( |
|
551 |
room_control.server(), |
|
552 |
room_control.room(), |
|
553 |
"kicked", |
|
554 |
leave_result, |
|
555 |
response, |
|
556 |
); |
|
14708
5122c584804e
Server action refactoring part A of N
alfadur <mail@none>
parents:
14707
diff
changeset
|
557 |
} |
16015 | 558 |
VoteEffect::Map(location) => { |
559 |
let msg = server_chat(location.to_string()); |
|
560 |
let room = room_control.room(); |
|
561 |
response.add(msg.send_all().in_room(room.id)); |
|
14708
5122c584804e
Server action refactoring part A of N
alfadur <mail@none>
parents:
14707
diff
changeset
|
562 |
|
16015 | 563 |
let room_master = room.master_id.map(|id| room_control.server().client(id)); |
15547 | 564 |
|
16015 | 565 |
get_room_update(None, room, room_master, response); |
15547 | 566 |
|
16015 | 567 |
let room_destination = Destination::ToAll { |
568 |
group: DestinationGroup::Room(room.id), |
|
569 |
skip_self: false, |
|
570 |
}; |
|
571 |
get_active_room_config(room, room_destination, response); |
|
14708
5122c584804e
Server action refactoring part A of N
alfadur <mail@none>
parents:
14707
diff
changeset
|
572 |
} |
16015 | 573 |
VoteEffect::Pause => { |
574 |
response.add( |
|
575 |
server_chat("Pause toggled.".to_string()) |
|
576 |
.send_all() |
|
577 |
.in_room(room_id), |
|
578 |
); |
|
579 |
response.add( |
|
580 |
ForwardEngineMessage(vec![to_engine_msg(once(b'I'))]) |
|
581 |
.send_all() |
|
582 |
.in_room(room_id), |
|
583 |
); |
|
14708
5122c584804e
Server action refactoring part A of N
alfadur <mail@none>
parents:
14707
diff
changeset
|
584 |
} |
16015 | 585 |
VoteEffect::NewSeed(cfg) => { |
15547 | 586 |
response.add(cfg.to_server_msg().send_all().in_room(room_id)); |
14707
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
587 |
} |
16015 | 588 |
VoteEffect::HedgehogsPerTeam(number, team_names) => { |
15547 | 589 |
response.extend( |
16015 | 590 |
team_names |
15547 | 591 |
.into_iter() |
592 |
.map(|n| HedgehogsNumber(n, number).send_all().in_room(room_id)), |
|
593 |
); |
|
14708
5122c584804e
Server action refactoring part A of N
alfadur <mail@none>
parents:
14707
diff
changeset
|
594 |
} |
14707
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
595 |
} |
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
596 |
} |
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
597 |
} |
9f98086de1b6
Server action refactoring part 9 of N
alfadur <mail@none>
parents:
14704
diff
changeset
|
598 |
|
15514 | 599 |
pub fn get_start_game_data( |
600 |
server: &HwServer, |
|
601 |
room_id: RoomId, |
|
602 |
result: Result<Vec<String>, StartGameError>, |
|
603 |
response: &mut Response, |
|
604 |
) { |
|
605 |
match result { |
|
606 |
Ok(room_nicks) => { |
|
607 |
let room = server.room(room_id); |
|
608 |
response.add(RunGame.send_all().in_room(room.id)); |
|
609 |
response.add( |
|
610 |
ClientFlags(add_flags(&[Flags::InGame]), room_nicks) |
|
611 |
.send_all() |
|
612 |
.in_room(room.id), |
|
613 |
); |
|
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
614 |
|
15514 | 615 |
let room_master = room.master_id.map(|id| server.client(id)); |
616 |
get_room_update(None, room, room_master, response); |
|
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
617 |
} |
15514 | 618 |
Err(StartGameError::NotEnoughClans) => { |
619 |
response.warn("The game can't be started with less than two clans!") |
|
620 |
} |
|
621 |
Err(StartGameError::NotReady) => response.warn("Not all players are ready"), |
|
15538 | 622 |
Err(StartGameError::AlreadyInGame) => response.warn("The game is already in progress"), |
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
623 |
} |
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
624 |
} |
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
625 |
|
15538 | 626 |
pub fn get_end_game_result( |
627 |
server: &HwServer, |
|
628 |
room_id: RoomId, |
|
629 |
result: EndGameResult, |
|
630 |
response: &mut Response, |
|
631 |
) { |
|
632 |
let room = server.room(room_id); |
|
15547 | 633 |
let room_master = room.master_id.map(|id| server.client(id)); |
15538 | 634 |
|
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
635 |
get_room_update(None, room, room_master, response); |
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
636 |
response.add(RoundFinished.send_all().in_room(room_id)); |
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
637 |
|
15563 | 638 |
response.extend( |
639 |
result |
|
640 |
.left_teams |
|
641 |
.iter() |
|
15591 | 642 |
.filter(|name| room.find_team(|t| t.name == **name).is_some()) |
15563 | 643 |
.map(|name| TeamRemove(name.clone()).send_all().in_room(room.id)), |
644 |
); |
|
645 |
||
15538 | 646 |
if !result.unreadied_nicks.is_empty() { |
15563 | 647 |
response.add( |
15538 | 648 |
ClientFlags(remove_flags(&[Flags::Ready]), result.unreadied_nicks) |
15563 | 649 |
.send_all() |
650 |
.in_room(room_id), |
|
651 |
); |
|
14709
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
652 |
} |
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
653 |
} |
4569d8d50286
Server action refactoring part B of N
alfadur <mail@none>
parents:
14708
diff
changeset
|
654 |
|
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
655 |
#[cfg(test)] |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
656 |
mod tests { |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
657 |
use super::*; |
15132 | 658 |
use crate::handlers::actions::PendingMessage; |
15826 | 659 |
use hedgewars_network_protocol::messages::HwServerMessage::ChatMsg; |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
660 |
|
15096 | 661 |
fn reply2string(r: HwServerMessage) -> String { |
13445
d3c86ade3d4d
Send the rnd reply to the room only.
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13444
diff
changeset
|
662 |
match r { |
d3c86ade3d4d
Send the rnd reply to the room only.
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13444
diff
changeset
|
663 |
ChatMsg { msg: p, .. } => String::from(p), |
d3c86ade3d4d
Send the rnd reply to the room only.
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13444
diff
changeset
|
664 |
_ => panic!("expected a ChatMsg"), |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
665 |
} |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
666 |
} |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
667 |
|
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
668 |
fn run_handle_test(opts: Vec<String>) { |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
669 |
let opts2 = opts.clone(); |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
670 |
for opt in opts { |
13492 | 671 |
while reply2string(rnd_reply(&opts2)) != opt {} |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
672 |
} |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
673 |
} |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
674 |
|
13446
dd2e51f7303d
Add an extra test for Rnd's distribution
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13445
diff
changeset
|
675 |
/// This test terminates almost surely. |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
676 |
#[test] |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
677 |
fn test_handle_rnd_empty() { |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
678 |
run_handle_test(vec![]) |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
679 |
} |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
680 |
|
13446
dd2e51f7303d
Add an extra test for Rnd's distribution
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13445
diff
changeset
|
681 |
/// This test terminates almost surely. |
13444
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
682 |
#[test] |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
683 |
fn test_handle_rnd_nonempty() { |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
684 |
run_handle_test(vec!["A".to_owned(), "B".to_owned(), "C".to_owned()]) |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
685 |
} |
914f9b970f4d
Implement server-side logic for Rnd
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
diff
changeset
|
686 |
} |