equal
deleted
inserted
replaced
189 |
189 |
190 if room.is_fixed() && room.ready_players_number == room.players_number { |
190 if room.is_fixed() && room.ready_players_number == room.players_number { |
191 super::common::start_game(server, room_id, response); |
191 super::common::start_game(server, room_id, response); |
192 } |
192 } |
193 } |
193 } |
194 AddTeam(info) => { |
194 AddTeam(mut info) => { |
195 if room.teams.len() >= room.team_limit as usize { |
195 if room.teams.len() >= room.team_limit as usize { |
196 response.add(Warning("Too many teams!".to_string()).send_self()); |
196 response.add(Warning("Too many teams!".to_string()).send_self()); |
197 } else if room.addable_hedgehogs() == 0 { |
197 } else if room.addable_hedgehogs() == 0 { |
198 response.add(Warning("Too many hedgehogs!".to_string()).send_self()); |
198 response.add(Warning("Too many hedgehogs!".to_string()).send_self()); |
199 } else if room.find_team(|t| t.name == info.name) != None { |
199 } else if room.find_team(|t| t.name == info.name) != None { |
209 response.add( |
209 response.add( |
210 Warning("This room currently does not allow adding new teams.".to_string()) |
210 Warning("This room currently does not allow adding new teams.".to_string()) |
211 .send_self(), |
211 .send_self(), |
212 ); |
212 ); |
213 } else { |
213 } else { |
|
214 info.owner = client.nick.clone(); |
214 let team = room.add_team(client.id, *info, client.protocol_number < 42); |
215 let team = room.add_team(client.id, *info, client.protocol_number < 42); |
215 client.teams_in_game += 1; |
216 client.teams_in_game += 1; |
216 client.clan = Some(team.color); |
217 client.clan = Some(team.color); |
217 response.add(TeamAccepted(team.name.clone()).send_self()); |
218 response.add(TeamAccepted(team.name.clone()).send_self()); |
218 response.add( |
219 response.add( |
219 TeamAdd(HWRoom::team_info(&client, team)) |
220 TeamAdd(team.to_protocol()) |
220 .send_all() |
221 .send_all() |
221 .in_room(room_id) |
222 .in_room(room_id) |
222 .but_self(), |
223 .but_self(), |
223 ); |
224 ); |
224 response.add( |
225 response.add( |
335 .send_all() |
336 .send_all() |
336 .in_room(room_id), |
337 .in_room(room_id), |
337 ); |
338 ); |
338 room.save_config(name, location); |
339 room.save_config(name, location); |
339 } |
340 } |
|
341 #[cfg(feature = "official-server")] |
340 SaveRoom(filename) => { |
342 SaveRoom(filename) => { |
341 if client.is_admin() { |
343 if client.is_admin() { |
342 match room.get_saves() { |
344 match room.get_saves() { |
343 Ok(contents) => response.request_io(super::IoTask::SaveRoom { |
345 Ok(contents) => response.request_io(super::IoTask::SaveRoom { |
344 room_id, |
346 room_id, |
353 ) |
355 ) |
354 } |
356 } |
355 } |
357 } |
356 } |
358 } |
357 } |
359 } |
|
360 #[cfg(feature = "official-server")] |
358 LoadRoom(filename) => { |
361 LoadRoom(filename) => { |
359 if client.is_admin() { |
362 if client.is_admin() { |
360 response.request_io(super::IoTask::LoadRoom { room_id, filename }); |
363 response.request_io(super::IoTask::LoadRoom { room_id, filename }); |
361 } |
364 } |
362 } |
365 } |