rust/hedgewars-server/src/core/server.rs
changeset 15989 fb389df02e3e
parent 15988 0b2e0a7d0431
child 16000 d9f1b239b6d7
equal deleted inserted replaced
15988:0b2e0a7d0431 15989:fb389df02e3e
   197     replay_storage: Option<ReplayStorage>,
   197     replay_storage: Option<ReplayStorage>,
   198 }
   198 }
   199 
   199 
   200 impl HwServer {
   200 impl HwServer {
   201     pub fn new(clients_limit: usize, rooms_limit: usize) -> Self {
   201     pub fn new(clients_limit: usize, rooms_limit: usize) -> Self {
   202         todo!("add reconnection IDs");
   202         //todo!("add reconnection IDs");
   203         let rooms = Slab::with_capacity(rooms_limit);
   203         let rooms = Slab::with_capacity(rooms_limit);
   204         let clients = IndexSlab::with_capacity(clients_limit);
   204         let clients = IndexSlab::with_capacity(clients_limit);
   205         let checkers = IndexSlab::new();
   205         let checkers = IndexSlab::new();
   206         Self {
   206         Self {
   207             clients,
   207             clients,
   778                 .map(|s| VoteEffect::Map(s.to_string())),
   778                 .map(|s| VoteEffect::Map(s.to_string())),
   779             VoteType::Pause => Some(VoteEffect::Pause).filter(|_| self.toggle_pause()),
   779             VoteType::Pause => Some(VoteEffect::Pause).filter(|_| self.toggle_pause()),
   780             VoteType::NewSeed => {
   780             VoteType::NewSeed => {
   781                 let seed = thread_rng().gen_range(0..1_000_000_000).to_string();
   781                 let seed = thread_rng().gen_range(0..1_000_000_000).to_string();
   782                 let cfg = GameCfg::Seed(seed);
   782                 let cfg = GameCfg::Seed(seed);
   783                 todo!("Protocol backwards compatibility");
   783                 //todo!("Protocol backwards compatibility");
   784                 self.room_mut().set_config(cfg.clone());
   784                 self.room_mut().set_config(cfg.clone());
   785                 Some(VoteEffect::NewSeed(cfg))
   785                 Some(VoteEffect::NewSeed(cfg))
   786             }
   786             }
   787             VoteType::HedgehogsPerTeam(number) => {
   787             VoteType::HedgehogsPerTeam(number) => {
   788                 let nicks = self.set_hedgehogs_number(number);
   788                 let nicks = self.set_hedgehogs_number(number);