gameServer2/src/protocol/messages.rs
changeset 12137 193dfdcb0620
parent 12136 e25a82ce2374
child 12141 78925eff02c2
equal deleted inserted replaced
12136:e25a82ce2374 12137:193dfdcb0620
    65     ForceVote(&'a str),
    65     ForceVote(&'a str),
    66     Save(&'a str, &'a str),
    66     Save(&'a str, &'a str),
    67     Delete(&'a str),
    67     Delete(&'a str),
    68     SaveRoom(&'a str),
    68     SaveRoom(&'a str),
    69     LoadRoom(&'a str),
    69     LoadRoom(&'a str),
       
    70     Connected(u32),
       
    71     Malformed,
       
    72     Empty,
    70 }
    73 }
    71 
    74 
    72 pub fn number<T: From<u8>
    75 pub fn number<T: From<u8>
    73                 + std::default::Default
    76                 + std::default::Default
    74                 + std::ops::MulAssign
    77                 + std::ops::MulAssign
    99         match self {
   102         match self {
   100             &HWProtocolMessage::Ping
   103             &HWProtocolMessage::Ping
   101                 => "PING\n\n".to_string(),
   104                 => "PING\n\n".to_string(),
   102             &HWProtocolMessage::Pong
   105             &HWProtocolMessage::Pong
   103                 => "PONG\n\n".to_string(),
   106                 => "PONG\n\n".to_string(),
       
   107             &HWProtocolMessage::Connected(protocol_version)
       
   108                 => construct_message(&[
       
   109                     "CONNECTED",
       
   110                     "Hedgewars server http://www.hedgewars.org/",
       
   111                     &protocol_version.to_string()
       
   112                 ]),
   104             &HWProtocolMessage::Bye(msg)
   113             &HWProtocolMessage::Bye(msg)
   105                 => construct_message(&["BYE", msg]),
   114                 => construct_message(&["BYE", msg]),
   106             &HWProtocolMessage::LobbyLeft(msg)
   115             &HWProtocolMessage::LobbyLeft(msg)
   107                 => construct_message(&["LOBBY_LEFT", msg]),
   116                 => construct_message(&["LOBBY_LEFT", msg]),
   108             _ => String::new()
   117             _ => String::new()