gameServer2/src/server/handlers/inroom.rs
changeset 13485 fb37745c5bca
parent 13483 d79795acaa73
child 13525 1ee192f13456
--- a/gameServer2/src/server/handlers/inroom.rs	Mon Jul 09 19:39:15 2018 +0300
+++ b/gameServer2/src/server/handlers/inroom.rs	Mon Jul 09 19:41:26 2018 +0300
@@ -71,6 +71,16 @@
     msg.get(1).filter(|t| !NON_TIMED_MESSAGES.contains(t)).is_some()
 }
 
+fn voting_description(kind: &VoteType) -> String {
+    format!("New voting started: {}", match kind {
+        VoteType::Kick(nick) => format!("kick {}", nick),
+        VoteType::Map(name) => format!("map {}", name.as_ref().unwrap()),
+        VoteType::Pause => "pause".to_string(),
+        VoteType::NewSeed => "new seed".to_string(),
+        VoteType::HedgehogsPerTeam(number) => format!("hedgehogs per team: {}", number)
+    })
+}
+
 pub fn handle(server: &mut HWServer, client_id: ClientId, message: HWProtocolMessage) {
     use protocol::messages::HWProtocolMessage::*;
     match message {
@@ -304,11 +314,11 @@
             };
             match error {
                 None => {
+                    let msg = voting_description(&kind);
                     let voting = Voting::new(kind, server.room_clients(client_id));
                     server.room(client_id).unwrap().voting = Some(voting);
                     server.react(client_id, vec![
-                        server_chat("New voting started: ")
-                            .send_all().in_room(room_id).action(),
+                        server_chat(&msg).send_all().in_room(room_id).action(),
                         AddVote{ vote: true, is_forced: false}]);
                 }
                 Some(msg) => {