rust/hedgewars-server/src/server/core.rs
changeset 14676 455865ccd36c
parent 14509 6cc0fce249f9
child 14677 6e6632068a33
--- a/rust/hedgewars-server/src/server/core.rs	Fri Jan 25 06:46:13 2019 +0100
+++ b/rust/hedgewars-server/src/server/core.rs	Sat Feb 02 15:06:39 2019 +0300
@@ -73,13 +73,6 @@
         allocate_room(&mut self.rooms)
     }
 
-    pub fn handle_msg(&mut self, client_id: ClientId, msg: HWProtocolMessage) {
-        debug!("Handling message {:?} for client {}", msg, client_id);
-        if self.clients.contains(client_id) {
-            handlers::handle(self, client_id, msg);
-        }
-    }
-
     #[inline]
     pub fn create_room(
         &mut self,
@@ -95,6 +88,11 @@
         )
     }
 
+    #[inline]
+    pub fn move_to_room(&mut self, client_id: ClientId, room_id: RoomId) {
+        move_to_room(&mut self.clients[client_id], &mut self.rooms[room_id])
+    }
+
     fn get_recipients(&self, client_id: ClientId, destination: &Destination) -> Vec<ClientId> {
         let mut ids = match *destination {
             Destination::ToSelf => vec![client_id],
@@ -129,6 +127,10 @@
         self.output.push((ids, message));
     }
 
+    pub fn send_msg(&mut self, client_id: ClientId, message: PendingMessage) {
+        self.send(client_id, &message.destination, message.message)
+    }
+
     pub fn react(&mut self, client_id: ClientId, actions: Vec<actions::Action>) {
         for action in actions {
             actions::run_action(self, client_id, action);