rust/hedgewars-server/src/handlers/common.rs
changeset 15553 852682c2003f
parent 15544 77551d5e0a3b
child 15554 36687bc9d5c1
equal deleted inserted replaced
15552:0031683bfa76 15553:852682c2003f
   166                 ClientFlags(remove_flags(&[*flag]), replace(cleared_nicks, vec![])).send_self(),
   166                 ClientFlags(remove_flags(&[*flag]), replace(cleared_nicks, vec![])).send_self(),
   167             );
   167             );
   168         }
   168         }
   169     }
   169     }
   170 
   170 
   171     get_room_teams(room, Destination::ToSelf, response);
   171     get_active_room_teams(room, Destination::ToSelf, response);
   172     get_room_config(room, Destination::ToSelf, response);
   172     get_active_room_config(room, Destination::ToSelf, response);
   173 
   173 
   174     if !room.greeting.is_empty() {
   174     if !room.greeting.is_empty() {
   175         response.add(
   175         response.add(
   176             ChatMsg {
   176             ChatMsg {
   177                 nick: "[greeting]".to_string(),
   177                 nick: "[greeting]".to_string(),
   356     for cfg in config.to_game_config() {
   356     for cfg in config.to_game_config() {
   357         response.add(cfg.to_server_msg().send_to_destination(destination.clone()));
   357         response.add(cfg.to_server_msg().send_to_destination(destination.clone()));
   358     }
   358     }
   359 }
   359 }
   360 
   360 
   361 pub fn get_room_config(room: &HwRoom, destination: Destination, response: &mut Response) {
   361 pub fn get_active_room_config(room: &HwRoom, destination: Destination, response: &mut Response) {
   362     get_room_config_impl(room.active_config(), destination, response);
   362     get_room_config_impl(room.active_config(), destination, response);
   363 }
   363 }
   364 
   364 
   365 pub fn get_teams<'a, I>(teams: I, destination: Destination, response: &mut Response)
   365 pub fn get_teams<'a, I>(teams: I, destination: Destination, response: &mut Response)
   366 where
   366 where
   375                 .send_to_destination(destination.clone()),
   375                 .send_to_destination(destination.clone()),
   376         );
   376         );
   377     }
   377     }
   378 }
   378 }
   379 
   379 
   380 pub fn get_room_teams(room: &HwRoom, destination: Destination, response: &mut Response) {
   380 pub fn get_active_room_teams(room: &HwRoom, destination: Destination, response: &mut Response) {
   381     let current_teams = match room.game_info {
   381     let current_teams = match room.game_info {
   382         Some(ref info) => &info.original_teams,
   382         Some(ref info) => &info.original_teams,
   383         None => &room.teams,
   383         None => &room.teams,
   384     };
   384     };
   385 
   385 
   528 
   528 
   529                     let room_destination = Destination::ToAll {
   529                     let room_destination = Destination::ToAll {
   530                         group: DestinationGroup::Room(room.id),
   530                         group: DestinationGroup::Room(room.id),
   531                         skip_self: false,
   531                         skip_self: false,
   532                     };
   532                     };
   533                     super::common::get_room_config(room, room_destination, response);
   533                     super::common::get_active_room_config(room, room_destination, response);
   534                 }
   534                 }
   535             }
   535             }
   536             VoteType::Pause => {
   536             VoteType::Pause => {
   537                 if room_control.toggle_pause() {
   537                 if room_control.toggle_pause() {
   538                     response.add(
   538                     response.add(
   616         response.add(
   616         response.add(
   617             HedgehogsNumber(team.name.clone(), team.hedgehogs_number)
   617             HedgehogsNumber(team.name.clone(), team.hedgehogs_number)
   618                 .send_to_destination(midgame_destination.clone()),
   618                 .send_to_destination(midgame_destination.clone()),
   619         );
   619         );
   620     }
   620     }
   621     super::common::get_room_config(room, midgame_destination.clone(), response);
   621     super::common::get_active_room_config(room, midgame_destination.clone(), response);
   622 
   622 
   623     if !result.unreadied_nicks.is_empty() {
   623     if !result.unreadied_nicks.is_empty() {
   624         response.add(
   624         response.add(
   625             ClientFlags(remove_flags(&[Flags::Ready]), result.unreadied_nicks)
   625             ClientFlags(remove_flags(&[Flags::Ready]), result.unreadied_nicks)
   626                 .send_all()
   626                 .send_all()