gameServer2/src/protocol/messages.rs
changeset 13666 09f4a30e50cc
parent 13531 282218ab1b28
child 13667 bfc2727daead
equal deleted inserted replaced
13665:5664650befcd 13666:09f4a30e50cc
     1 use server::coretypes::{
     1 use crate::server::coretypes::{
     2     ServerVar, GameCfg, TeamInfo,
     2     ServerVar, GameCfg, TeamInfo,
     3     HedgehogInfo, VoteType
     3     HedgehogInfo, VoteType
     4 };
     4 };
     5 use std::{ops, convert::From, iter::once};
     5 use std::{ops, convert::From, iter::once};
     6 
     6 
   109     HWServerMessage::ChatMsg{ nick: "[server]".to_string(), msg }
   109     HWServerMessage::ChatMsg{ nick: "[server]".to_string(), msg }
   110 }
   110 }
   111 
   111 
   112 impl GameCfg {
   112 impl GameCfg {
   113     pub fn to_protocol(&self) -> (String, Vec<String>) {
   113     pub fn to_protocol(&self) -> (String, Vec<String>) {
   114         use server::coretypes::GameCfg::*;
   114         use crate::server::coretypes::GameCfg::*;
   115         match self {
   115         match self {
   116             FeatureSize(s) => ("FEATURE_SIZE".to_string(), vec![s.to_string()]),
   116             FeatureSize(s) => ("FEATURE_SIZE".to_string(), vec![s.to_string()]),
   117             MapType(t) => ("MAP".to_string(), vec![t.to_string()]),
   117             MapType(t) => ("MAP".to_string(), vec![t.to_string()]),
   118             MapGenerator(g) => ("MAPGEN".to_string(), vec![g.to_string()]),
   118             MapGenerator(g) => ("MAPGEN".to_string(), vec![g.to_string()]),
   119             MazeSize(s) => ("MAZE_SIZE".to_string(), vec![s.to_string()]),
   119             MazeSize(s) => ("MAZE_SIZE".to_string(), vec![s.to_string()]),
   258         match self {
   258         match self {
   259             Ping => msg!["PING"],
   259             Ping => msg!["PING"],
   260             Pong => msg!["PONG"],
   260             Pong => msg!["PONG"],
   261             Connected(protocol_version) => msg![
   261             Connected(protocol_version) => msg![
   262                 "CONNECTED",
   262                 "CONNECTED",
   263                 "Hedgewars server https://www.hedgewars.org/",
   263                 "Hedgewars server http://www.hedgewars.org/",
   264                 protocol_version],
   264                 protocol_version],
   265             Bye(msg) => msg!["BYE", msg],
   265             Bye(msg) => msg!["BYE", msg],
   266             Nick(nick) => msg!["NICK", nick],
   266             Nick(nick) => msg!["NICK", nick],
   267             Proto(proto) => msg!["PROTO", proto],
   267             Proto(proto) => msg!["PROTO", proto],
   268             LobbyLeft(nick, msg) => msg!["LOBBY:LEFT", nick, msg],
   268             LobbyLeft(nick, msg) => msg!["LOBBY:LEFT", nick, msg],