rust/hedgewars-server/src/core/room.rs
changeset 15075 e935b1ad23f3
parent 15074 c5a6e8566425
child 15482 4cc9ec732392
equal deleted inserted replaced
15074:c5a6e8566425 15075:e935b1ad23f3
     1 use super::{
     1 use super::{
     2     client::HWClient,
     2     client::HwClient,
     3     types::{
     3     types::{
     4         ClientId, GameCfg, GameCfg::*, RoomConfig, RoomId, TeamInfo, Voting, MAX_HEDGEHOGS_PER_TEAM,
     4         ClientId, GameCfg, GameCfg::*, RoomConfig, RoomId, TeamInfo, Voting, MAX_HEDGEHOGS_PER_TEAM,
     5     },
     5     },
     6 };
     6 };
     7 use bitflags::*;
     7 use bitflags::*;
    64         const RESTRICTED_TEAM_ADD = 0b0000_0100;
    64         const RESTRICTED_TEAM_ADD = 0b0000_0100;
    65         const RESTRICTED_UNREGISTERED_PLAYERS = 0b0000_1000;
    65         const RESTRICTED_UNREGISTERED_PLAYERS = 0b0000_1000;
    66     }
    66     }
    67 }
    67 }
    68 
    68 
    69 pub struct HWRoom {
    69 pub struct HwRoom {
    70     pub id: RoomId,
    70     pub id: RoomId,
    71     pub master_id: Option<ClientId>,
    71     pub master_id: Option<ClientId>,
    72     pub name: String,
    72     pub name: String,
    73     pub password: Option<String>,
    73     pub password: Option<String>,
    74     pub greeting: String,
    74     pub greeting: String,
    84     pub voting: Option<Voting>,
    84     pub voting: Option<Voting>,
    85     pub saves: HashMap<String, RoomSave>,
    85     pub saves: HashMap<String, RoomSave>,
    86     pub game_info: Option<GameInfo>,
    86     pub game_info: Option<GameInfo>,
    87 }
    87 }
    88 
    88 
    89 impl HWRoom {
    89 impl HwRoom {
    90     pub fn new(id: RoomId) -> HWRoom {
    90     pub fn new(id: RoomId) -> HwRoom {
    91         HWRoom {
    91         HwRoom {
    92             id,
    92             id,
    93             master_id: None,
    93             master_id: None,
    94             name: String::new(),
    94             name: String::new(),
    95             password: None,
    95             password: None,
    96             greeting: "".to_string(),
    96             greeting: "".to_string(),
   273             result += "r"
   273             result += "r"
   274         }
   274         }
   275         result
   275         result
   276     }
   276     }
   277 
   277 
   278     pub fn info(&self, master: Option<&HWClient>) -> Vec<String> {
   278     pub fn info(&self, master: Option<&HwClient>) -> Vec<String> {
   279         let c = &self.config;
   279         let c = &self.config;
   280         vec![
   280         vec![
   281             self.flags_string(),
   281             self.flags_string(),
   282             self.name.clone(),
   282             self.name.clone(),
   283             self.players_number.to_string(),
   283             self.players_number.to_string(),