rust/hedgewars-server/src/server/handlers/inroom.rs
changeset 14690 f61ce544d436
parent 14689 aae29ba56aec
child 14691 2071da901c63
equal deleted inserted replaced
14689:aae29ba56aec 14690:f61ce544d436
     3 use super::common::rnd_reply;
     3 use super::common::rnd_reply;
     4 use crate::utils::to_engine_msg;
     4 use crate::utils::to_engine_msg;
     5 use crate::{
     5 use crate::{
     6     protocol::messages::{server_chat, HWProtocolMessage, HWServerMessage::*},
     6     protocol::messages::{server_chat, HWProtocolMessage, HWServerMessage::*},
     7     server::{
     7     server::{
     8         actions::{Action, Action::*},
       
     9         core::HWServer,
     8         core::HWServer,
    10         coretypes,
     9         coretypes,
    11         coretypes::{ClientId, GameCfg, RoomId, VoteType, Voting, MAX_HEDGEHOGS_PER_TEAM},
    10         coretypes::{ClientId, GameCfg, RoomId, VoteType, Voting, MAX_HEDGEHOGS_PER_TEAM},
    12         room::{HWRoom, RoomFlags},
    11         room::{HWRoom, RoomFlags},
    13     },
    12     },
   116             if let (client, Some(room)) = server.client_and_room(client_id) {
   115             if let (client, Some(room)) = server.client_and_room(client_id) {
   117                 let msg = match msg {
   116                 let msg = match msg {
   118                     Some(s) => format!("part: {}", s),
   117                     Some(s) => format!("part: {}", s),
   119                     None => "part".to_string(),
   118                     None => "part".to_string(),
   120                 };
   119                 };
   121                 super::common::exit_room(client, room, response, &msg);
   120                 super::common::exit_room(server, client_id, response, &msg);
   122                 client.room_id = Some(lobby_id);
       
   123             }
   121             }
   124         }
   122         }
   125         Chat(msg) => {
   123         Chat(msg) => {
   126             let client = &mut server.clients[client_id];
   124             let client = &mut server.clients[client_id];
   127             response.add(
   125             response.add(
   134             );
   132             );
   135         }
   133         }
   136         Fix => {
   134         Fix => {
   137             if let (client, Some(room)) = server.client_and_room(client_id) {
   135             if let (client, Some(room)) = server.client_and_room(client_id) {
   138                 if client.is_admin() {
   136                 if client.is_admin() {
   139                     room.set_is_fixed(true)
   137                     room.set_is_fixed(true);
       
   138                     room.set_join_restriction(false);
       
   139                     room.set_team_add_restriction(false);
       
   140                     room.set_unregistered_players_restriction(true);
   140                 }
   141                 }
   141             }
   142             }
   142         }
   143         }
   143         Unfix => {
   144         Unfix => {
   144             if let (client, Some(room)) = server.client_and_room(client_id) {
   145             if let (client, Some(room)) = server.client_and_room(client_id) {