gameServer2/src/server/actions.rs
changeset 12857 bd35cb2302b3
parent 12153 8591375271b8
child 12858 a9d105dc5c95
--- a/gameServer2/src/server/actions.rs	Tue Dec 05 11:36:29 2017 -0500
+++ b/gameServer2/src/server/actions.rs	Wed Dec 06 23:46:17 2017 +0100
@@ -22,12 +22,12 @@
 
 use self::Action::*;
 
-pub fn run_action(server: &mut HWServer, token: mio::Token, poll: &mio::Poll, action: Action) {
+pub fn run_action(server: &mut HWServer, token: usize, poll: &mio::Poll, action: Action) {
     match action {
         SendMe(msg) =>
             server.send(token, &msg),
         SendAllButMe(msg) => {
-            for c in server.clients.iter_mut() {
+            for (i, c) in server.clients.iter_mut() {
                 if c.id != token {
                     c.send_string(&msg)
                 }
@@ -57,7 +57,7 @@
             let joined_msg;
             {
                 let mut lobby_nicks: Vec<&str> = Vec::new();
-                for c in server.clients.iter() {
+                for (_, c) in server.clients.iter() {
                     if c.room_id.is_some() {
                         lobby_nicks.push(&c.nick);
                     }
@@ -71,7 +71,7 @@
                 ]);
         },
         AddRoom(name, password) => {
-            let room_id = server.rooms.insert(HWRoom::new()).ok().expect("Cannot add room");
+            let room_id = server.rooms.insert(HWRoom::new());
             {
                 let r = &mut server.rooms[room_id];
                 let c = &mut server.clients[token];