rust/hedgewars-server/src/handlers/common.rs
changeset 15719 25371cae9fd7
parent 15601 db710cd8df69
child 15817 40929af15167
--- a/rust/hedgewars-server/src/handlers/common.rs	Tue Jul 07 00:11:20 2020 +0200
+++ b/rust/hedgewars-server/src/handlers/common.rs	Tue Jul 07 01:15:15 2020 +0300
@@ -212,18 +212,21 @@
 
         for (_, original_team) in &info.original_teams {
             if let Some(team) = room.find_team(|team| team.name == original_team.name) {
-                if team.color != original_team.color {
-                    response.add(TeamColor(team.name.clone(), team.color).send_self());
-                }
-                if team.hedgehogs_number != original_team.hedgehogs_number {
-                    response
-                        .add(HedgehogsNumber(team.name.clone(), team.hedgehogs_number).send_self());
+                if team != original_team {
+                    response.add(TeamRemove(original_team.name.clone()).send_self());
+                    response.add(TeamAdd(team.to_protocol()).send_self());
                 }
             } else {
                 response.add(TeamRemove(original_team.name.clone()).send_self());
             }
         }
 
+        for (_, team) in &room.teams {
+            if !info.original_teams.iter().any(|(_, t)| t.name == team.name) {
+                response.add(TeamAdd(team.to_protocol()).send_self());
+            }
+        }
+
         get_room_config_impl(room.config(), Destination::ToSelf, response);
     }
 }