--- a/rust/hedgewars-server/src/core/room.rs Thu Oct 24 09:41:10 2019 -0400
+++ b/rust/hedgewars-server/src/core/room.rs Sat Oct 26 02:36:08 2019 +0300
@@ -142,9 +142,22 @@
&self.teams.last().unwrap().1
}
- pub fn remove_team(&mut self, name: &str) {
- if let Some(index) = self.teams.iter().position(|(_, t)| t.name == name) {
+ pub fn remove_team(&mut self, team_name: &str) {
+ if let Some(index) = self.teams.iter().position(|(_, t)| t.name == team_name) {
self.teams.remove(index);
+
+ if let Some(info) = &mut self.game_info {
+ info.left_teams.push(team_name.to_string());
+ info.teams_in_game -= 1;
+
+ if let Some(m) = &info.sync_msg {
+ info.msg_log.push(m.clone());
+ info.sync_msg = None
+ }
+ let remove_msg =
+ crate::utils::to_engine_msg(iter::once(b'F').chain(team_name.bytes()));
+ info.msg_log.push(remove_msg.clone());
+ }
}
}