gameServer2/src/server/actions.rs
changeset 12148 8591375271b8
parent 12147 03ccb89820f3
child 12852 bd35cb2302b3
equal deleted inserted replaced
12147:03ccb89820f3 12148:8591375271b8
    70                 SendMe(joined_msg),
    70                 SendMe(joined_msg),
    71                 ]);
    71                 ]);
    72         },
    72         },
    73         AddRoom(name, password) => {
    73         AddRoom(name, password) => {
    74             let room_id = server.rooms.insert(HWRoom::new()).ok().expect("Cannot add room");
    74             let room_id = server.rooms.insert(HWRoom::new()).ok().expect("Cannot add room");
    75             let r = &mut server.rooms[room_id];
    75             {
    76             r.name = name;
    76                 let r = &mut server.rooms[room_id];
    77             r.password = password;
    77                 let c = &mut server.clients[token];
    78             r.id = room_id.clone();
    78                 r.name = name;
    79             r.ready_players_number = 1;
    79                 r.password = password;
    80             server.clients[token].room_id = Some(room_id);
    80                 r.id = room_id.clone();
       
    81                 r.ready_players_number = 1;
       
    82                 r.protocol_number = c.protocol_number;
       
    83                 c.room_id = Some(room_id);
       
    84             }
       
    85 
    81         },
    86         },
    82         Warn(msg) => {
    87         Warn(msg) => {
    83             run_action(server, token, poll, SendMe(Warning(&msg).to_raw_protocol()));
    88             run_action(server, token, poll, SendMe(Warning(&msg).to_raw_protocol()));
    84         }
    89         }
    85         //_ => unimplemented!(),
    90         //_ => unimplemented!(),