rust/hedgewars-server/src/handlers/common.rs
changeset 15591 4b2f3228f13b
parent 15576 36687bc9d5c1
child 15601 db710cd8df69
equal deleted inserted replaced
15590:de1b31c2d2f2 15591:4b2f3228f13b
   207         }
   207         }
   208 
   208 
   209         if info.is_paused {
   209         if info.is_paused {
   210             response.add(ForwardEngineMessage(vec![to_engine_msg(once(b'I'))]).send_self());
   210             response.add(ForwardEngineMessage(vec![to_engine_msg(once(b'I'))]).send_self());
   211         }
   211         }
       
   212 
       
   213         for (_, original_team) in &info.original_teams {
       
   214             if let Some(team) = room.find_team(|team| team.name == original_team.name) {
       
   215                 if team.color != original_team.color {
       
   216                     response.add(TeamColor(team.name.clone(), team.color).send_self());
       
   217                 }
       
   218                 if team.hedgehogs_number != original_team.hedgehogs_number {
       
   219                     response
       
   220                         .add(HedgehogsNumber(team.name.clone(), team.hedgehogs_number).send_self());
       
   221                 }
       
   222             } else {
       
   223                 response.add(TeamRemove(original_team.name.clone()).send_self());
       
   224             }
       
   225         }
       
   226 
       
   227         get_room_config_impl(room.config(), Destination::ToSelf, response);
   212     }
   228     }
   213 }
   229 }
   214 
   230 
   215 pub fn get_room_join_error(error: JoinRoomError, response: &mut Response) {
   231 pub fn get_room_join_error(error: JoinRoomError, response: &mut Response) {
   216     use super::strings::*;
   232     use super::strings::*;
   606 
   622 
   607     response.extend(
   623     response.extend(
   608         result
   624         result
   609             .left_teams
   625             .left_teams
   610             .iter()
   626             .iter()
       
   627             .filter(|name| room.find_team(|t| t.name == **name).is_some())
   611             .map(|name| TeamRemove(name.clone()).send_all().in_room(room.id)),
   628             .map(|name| TeamRemove(name.clone()).send_all().in_room(room.id)),
   612     );
   629     );
   613 
       
   614     let midgame_destination = Destination::ToIds(result.joined_mid_game_clients);
       
   615     for (_, team) in &room.teams {
       
   616         response.add(
       
   617             HedgehogsNumber(team.name.clone(), team.hedgehogs_number)
       
   618                 .send_to_destination(midgame_destination.clone()),
       
   619         );
       
   620         response.add(
       
   621             TeamColor(team.name.clone(), team.color)
       
   622                 .send_to_destination(midgame_destination.clone()),
       
   623         );
       
   624     }
       
   625     super::common::get_active_room_config(room, midgame_destination.clone(), response);
       
   626 
   630 
   627     if !result.unreadied_nicks.is_empty() {
   631     if !result.unreadied_nicks.is_empty() {
   628         response.add(
   632         response.add(
   629             ClientFlags(remove_flags(&[Flags::Ready]), result.unreadied_nicks)
   633             ClientFlags(remove_flags(&[Flags::Ready]), result.unreadied_nicks)
   630                 .send_all()
   634                 .send_all()