rust/hedgewars-server/src/server/core.rs
changeset 14694 08a8605bafaf
parent 14693 6e6632068a33
child 14695 b87c71ccd17d
--- a/rust/hedgewars-server/src/server/core.rs	Mon Feb 04 19:22:21 2019 +0300
+++ b/rust/hedgewars-server/src/server/core.rs	Mon Feb 04 20:25:35 2019 +0300
@@ -61,12 +61,20 @@
         key
     }
 
-    pub fn client_lost(&mut self, client_id: ClientId) {
-        actions::run_action(
-            self,
-            client_id,
-            actions::Action::ByeClient("Connection reset".to_string()),
-        );
+    pub fn remove_client(&mut self, client_id: ClientId) {
+        let client = &self.clients[client_id];
+        let nick = client.nick.clone();
+
+        if let Some(id) = client.room_id {
+            if id != self.lobby_id {
+                //MoveToLobby(format!("quit: {}", msg.clone()))
+            }
+        }
+
+        self.removed_clients.push(client_id);
+        if self.clients.contains(client_id) {
+            self.clients.remove(client_id);
+        }
     }
 
     pub fn add_room(&mut self) -> &mut HWRoom {