rust/hedgewars-server/src/server/handlers/inroom.rs
changeset 14781 01f8ab45f806
parent 14780 65861ba8b4e8
child 14782 50fcef24003f
equal deleted inserted replaced
14780:65861ba8b4e8 14781:01f8ab45f806
   335             room.save_config(name, location);
   335             room.save_config(name, location);
   336         }
   336         }
   337         SaveRoom(filename) => {
   337         SaveRoom(filename) => {
   338             if client.is_admin() {
   338             if client.is_admin() {
   339                 match room.get_saves() {
   339                 match room.get_saves() {
   340                     Ok(contents) =>
   340                     Ok(contents) => response.request_io(super::IoTask::SaveRoom {
   341                         response.request_io(super::IoTask::SaveRoom {
   341                         room_id,
   342                             room_id, filename, contents
   342                         filename,
   343                         }),
   343                         contents,
       
   344                     }),
   344                     Err(e) => {
   345                     Err(e) => {
   345                         warn!("Error while serializing the room configs: {}", e);
   346                         warn!("Error while serializing the room configs: {}", e);
   346                         response.add(
   347                         response.add(
   347                             Warning("Unable to serialize the room configs.".to_string())
   348                             Warning("Unable to serialize the room configs.".to_string())
   348                                 .send_self(),
   349                                 .send_self(),
   351                 }
   352                 }
   352             }
   353             }
   353         }
   354         }
   354         LoadRoom(filename) => {
   355         LoadRoom(filename) => {
   355             if client.is_admin() {
   356             if client.is_admin() {
   356                 response.request_io(super::IoTask::LoadRoom {
   357                 response.request_io(super::IoTask::LoadRoom { room_id, filename });
   357                     room_id,
       
   358                     filename
       
   359                 });
       
   360             }
   358             }
   361         }
   359         }
   362         Delete(name) => {
   360         Delete(name) => {
   363             if !room.delete_config(&name) {
   361             if !room.delete_config(&name) {
   364                 response.add(Warning(format!("Save doesn't exist: {}", name)).send_self());
   362                 response.add(Warning(format!("Save doesn't exist: {}", name)).send_self());
   418             };
   416             };
   419 
   417 
   420             match error {
   418             match error {
   421                 None => {
   419                 None => {
   422                     let msg = voting_description(&kind);
   420                     let msg = voting_description(&kind);
   423                     let voting = Voting::new(kind, server.room_clients(client_id));
   421                     let voting = Voting::new(kind, server.collect_room_clients(client_id));
   424                     let room = &mut server.rooms[room_id];
   422                     let room = &mut server.rooms[room_id];
   425                     room.voting = Some(voting);
   423                     room.voting = Some(voting);
   426                     response.add(server_chat(msg).send_all().in_room(room_id));
   424                     response.add(server_chat(msg).send_all().in_room(room_id));
   427                     super::common::submit_vote(
   425                     super::common::submit_vote(
   428                         server,
   426                         server,