gameServer2/src/server/actions.rs
changeset 12148 8591375271b8
parent 12147 03ccb89820f3
child 12852 bd35cb2302b3
--- a/gameServer2/src/server/actions.rs	Sat Feb 04 19:52:38 2017 +0300
+++ b/gameServer2/src/server/actions.rs	Mon Feb 06 17:54:27 2017 +0300
@@ -72,12 +72,17 @@
         },
         AddRoom(name, password) => {
             let room_id = server.rooms.insert(HWRoom::new()).ok().expect("Cannot add room");
-            let r = &mut server.rooms[room_id];
-            r.name = name;
-            r.password = password;
-            r.id = room_id.clone();
-            r.ready_players_number = 1;
-            server.clients[token].room_id = Some(room_id);
+            {
+                let r = &mut server.rooms[room_id];
+                let c = &mut server.clients[token];
+                r.name = name;
+                r.password = password;
+                r.id = room_id.clone();
+                r.ready_players_number = 1;
+                r.protocol_number = c.protocol_number;
+                c.room_id = Some(room_id);
+            }
+
         },
         Warn(msg) => {
             run_action(server, token, poll, SendMe(Warning(&msg).to_raw_protocol()));