Store room protocol number
authorunc0rr
Mon, 06 Feb 2017 17:54:27 +0300
changeset 12148 8591375271b8
parent 12147 03ccb89820f3
child 12149 44b06731278b
Store room protocol number
gameServer2/src/server/actions.rs
gameServer2/src/server/server.rs
--- 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()));
--- a/gameServer2/src/server/server.rs	Sat Feb 04 19:52:38 2017 +0300
+++ b/gameServer2/src/server/server.rs	Mon Feb 06 17:54:27 2017 +0300
@@ -94,6 +94,7 @@
     pub id: Token,
     pub name: String,
     pub password: Option<String>,
+    pub protocol_number: u32,
     pub ready_players_number: u8,
 }
 
@@ -103,6 +104,7 @@
             id: Token(0),
             name: String::new(),
             password: None,
+            protocol_number: 0,
             ready_players_number: 0,
         }
     }