equal
deleted
inserted
replaced
984 .client_teams(client.id) |
984 .client_teams(client.id) |
985 .map(|t| t.name.clone()) |
985 .map(|t| t.name.clone()) |
986 .collect(); |
986 .collect(); |
987 |
987 |
988 if let Some(ref mut info) = room.game_info { |
988 if let Some(ref mut info) = room.game_info { |
989 info.teams_in_game -= team_names.len() as u8; |
|
990 |
|
991 for team_name in &team_names { |
989 for team_name in &team_names { |
992 let remove_msg = |
990 let remove_msg = |
993 utils::to_engine_msg(std::iter::once(b'F').chain(team_name.bytes())); |
991 utils::to_engine_msg(std::iter::once(b'F').chain(team_name.bytes())); |
994 if let Some(m) = &info.sync_msg { |
992 if let Some(m) = &info.sync_msg { |
995 info.msg_log.push(m.clone()); |
993 info.msg_log.push(m.clone()); |
1104 |
1102 |
1105 client.room_id = Some(room.id); |
1103 client.room_id = Some(room.id); |
1106 client.set_is_joined_mid_game(room.game_info.is_some()); |
1104 client.set_is_joined_mid_game(room.game_info.is_some()); |
1107 client.set_is_in_game(room.game_info.is_some()); |
1105 client.set_is_in_game(room.game_info.is_some()); |
1108 |
1106 |
1109 if let Some(ref mut info) = room.game_info { |
1107 let teams = room.client_teams(client.id); |
1110 let teams = info.client_teams(client.id); |
1108 client.teams_in_game = teams.clone().count() as u8; |
1111 client.teams_in_game = teams.clone().count() as u8; |
1109 client.clan = teams.clone().next().map(|t| t.color); |
1112 client.clan = teams.clone().next().map(|t| t.color); |
1110 let team_names: Vec<_> = teams.map(|t| t.name.clone()).collect(); |
1113 let team_names: Vec<_> = teams.map(|t| t.name.clone()).collect(); |
1111 |
1114 |
1112 match room.game_info { |
1115 if !team_names.is_empty() { |
1113 Some(ref mut info) if !team_names.is_empty() => { |
1116 info.left_teams.retain(|name| !team_names.contains(&name)); |
1114 info.left_teams.retain(|name| !team_names.contains(&name)) |
1117 info.teams_in_game += team_names.len() as u8; |
1115 } |
1118 room.teams = info |
1116 _ => (), |
1119 .teams_at_start |
1117 } |
1120 .iter() |
1118 } |
1121 .filter(|(_, t)| !team_names.contains(&t.name)) |
|
1122 .cloned() |
|
1123 .collect(); |
|
1124 } |
|
1125 } |
|
1126 } |
|